From: Emmanuel Bourg Date: Tue, 7 Feb 2012 00:06:07 +0000 (+0100) Subject: Replaced tabs with spaces X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=96e84143de30aca040f44983e00cf4011fb794e8;p=sven%2Fjava-package.git Replaced tabs with spaces Signed-off-by: Cédric Pineau --- diff --git a/lib/common.sh b/lib/common.sh index 64f5810..4f9edd4 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -2,15 +2,15 @@ read_yn() { local prompt="$1" while true; do - read -e -n 1 -p "$prompt" reply - case "$reply" in - "" | "y" | "Y") - return 0 - ;; - "N" | "n") - return 1 - ;; - esac + read -e -n 1 -p "$prompt" reply + case "$reply" in + "" | "y" | "Y") + return 0 + ;; + "N" | "n") + return 1 + ;; + esac done } @@ -27,12 +27,12 @@ diskusage() { diskfree() { local size="$1" echo -n "Checking free diskspace:" - (( free = `stat -f -c '%a / 2048 * ( %s / 512 )' $tmp ` )) + (( free = `stat -f -c '%a / 2048 * ( %s / 512 )' $tmp ` )) if [ "$free" -ge "$size" ]; then - echo " done." + echo " done." else - cat >&2 << EOF + cat >&2 << EOF WARNING: Possibly not enough free disk space in "$tmp". @@ -45,7 +45,7 @@ Press Ctrl+C to interrupt, or return to try to continue anyway. TMPDIR. EOF - read + read fi } @@ -69,23 +69,23 @@ EOF mkdir "$extract_dir" cd "$extract_dir" echo - + local extract_cmd case "$archive_path" in - *.tar) - extract_cmd="tar xf";; - *.tar.bz2) - extract_cmd="tar --bzip2 -xf";; - *.tgz|*.tar.gz) - extract_cmd="tar xfz";; - *.zip) - extract_cmd="unzip -q";; - *) - extract_cmd=sh + *.tar) + extract_cmd="tar xf";; + *.tar.bz2) + extract_cmd="tar --bzip2 -xf";; + *.tgz|*.tar.gz) + extract_cmd="tar xfz";; + *.zip) + extract_cmd="unzip -q";; + *) + extract_cmd=sh esac - + if ! $extract_cmd "$archive_path"; then - cat << EOF + cat << EOF WARNING: The package installation script exited with an error value. Usually, this means, that the installation failed for some @@ -96,13 +96,13 @@ Please check if there are any error messages. Press [Return] to continue or Ctrl-C to abort. EOF - read + read fi echo echo -n "Testing extracted archive..." local size="$( diskusage "$extract_dir" )" if [ "$size" -lt "$expected_min_size" ]; then - cat << EOF + cat << EOF Invalid size ($size MB) of extracted archive. Probably you have not enough free disc space in the temporary directory. Note: You can @@ -110,73 +110,73 @@ specify an alternate directory by setting the environment variable TMPDIR. EOF - error_exit + error_exit else - cd "$extract_dir" - files=(*) - if [ "${#files[*]}" -ne 1 ]; then - cat << EOF + cd "$extract_dir" + files=(*) + if [ "${#files[*]}" -ne 1 ]; then + cat << EOF Expected one file, but found the following ${#files[*]} files: ${files[*]} EOF - error_exit - fi - mv "$files" "$dest" - echo -e " okay.\n" + error_exit + fi + mv "$files" "$dest" + echo -e " okay.\n" fi } read_maintainer_info() { if [ -z "$maintainer_name" ]; then - if [ -n "$DEBFULLNAME" ]; then - maintainer_name="$DEBFULLNAME" - elif [ -n "$DEBNAME" ]; then - maintainer_name="$DEBNAME" - else - default_name="$(getent passwd $(id -run) | cut -d: -f5| cut -d, -f1)" - - cat << EOF + if [ -n "$DEBFULLNAME" ]; then + maintainer_name="$DEBFULLNAME" + elif [ -n "$DEBNAME" ]; then + maintainer_name="$DEBNAME" + else + default_name="$(getent passwd $(id -run) | cut -d: -f5| cut -d, -f1)" + + cat << EOF Please enter your full name. This value will be used in the maintainer field of the created package. EOF - # gecos can be null - while [ -z "$maintainer_name" ]; do - read -e -p "Full name [$default_name]:" maintainer_name - if [ -z "$maintainer_name" ] && [ -n "$default_name" ]; then - maintainer_name="$default_name" - fi - done - fi + # gecos can be null + while [ -z "$maintainer_name" ]; do + read -e -p "Full name [$default_name]:" maintainer_name + if [ -z "$maintainer_name" ] && [ -n "$default_name" ]; then + maintainer_name="$default_name" + fi + done + fi fi - + if [ -z "$maintainer_email" ]; then - local default_email= - if [ -n "$DEBEMAIL" ]; then - maintainer_email="$DEBEMAIL" - else - if [ -r "/etc/mailname" ]; then - default_email="$( id -run )@$( cat /etc/mailname )" - else - default_email="$( id -run )@$( hostname --fqdn )" - fi - cat << EOF + local default_email= + if [ -n "$DEBEMAIL" ]; then + maintainer_email="$DEBEMAIL" + else + if [ -r "/etc/mailname" ]; then + default_email="$( id -run )@$( cat /etc/mailname )" + else + default_email="$( id -run )@$( hostname --fqdn )" + fi + cat << EOF Please enter a valid email address or press return to accept the default value. This address will be used in the maintainer field of the created package. EOF - read -e -p "Email [$default_email]: " maintainer_email - if [ -z "$maintainer_email" ]; then - maintainer_email="$default_email" - fi - fi + read -e -p "Email [$default_email]: " maintainer_email + if [ -z "$maintainer_email" ]; then + maintainer_email="$default_email" + fi + fi fi } diff --git a/lib/j2se.sh b/lib/j2se.sh index 926060a..cd72d5e 100644 --- a/lib/j2se.sh +++ b/lib/j2se.sh @@ -81,8 +81,8 @@ if [ "\$1" = configure ]; then shift for program in \$*; do update-alternatives \\ - --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority \\ - --slave "/usr/share/man/man1/\$program.1.gz" "\$program.1.gz" "$jvm_base$j2se_name/man/man1/\$program.1.gz" + --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority \\ + --slave "/usr/share/man/man1/\$program.1.gz" "\$program.1.gz" "$jvm_base$j2se_name/man/man1/\$program.1.gz" done } diff --git a/lib/oracle-j2re.sh b/lib/oracle-j2re.sh index f0c1635..ad398a0 100644 --- a/lib/oracle-j2re.sh +++ b/lib/oracle-j2re.sh @@ -30,33 +30,33 @@ oracle_j2re_detect() { fi - cat << EOF + cat << EOF Detected product: Java(TM) Runtime Environment (JRE) Standard Edition, Version $j2se_release Update $j2se_update Oracle(TM) EOF - if read_yn "Is this correct [Y/n]: "; then - j2se_found=true - j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 )) - j2se_vendor="oracle" - j2se_title="Java(TM) JRE, Standard Edition, Oracle(TM)" + if read_yn "Is this correct [Y/n]: "; then + j2se_found=true + j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 )) + j2se_vendor="oracle" + j2se_title="Java(TM) JRE, Standard Edition, Oracle(TM)" - j2se_install=oracle_j2re_install - j2se_remove=oracle_j2re_remove - j2se_jinfo=oracle_j2re_jinfo - oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool" - oracle_jre_bin_jre="javaws policytool" - oracle_no_man_jre_bin_jre="ControlPanel" - oracle_jre_lib_hl="jexec" - j2re_run - fi + j2se_install=oracle_j2re_install + j2se_remove=oracle_j2re_remove + j2se_jinfo=oracle_j2re_jinfo + oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool" + oracle_jre_bin_jre="javaws policytool" + oracle_no_man_jre_bin_jre="ControlPanel" + oracle_jre_lib_hl="jexec" + j2re_run + fi fi } oracle_j2re_install() { - cat << EOF + cat << EOF if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then exit 0 fi @@ -73,7 +73,7 @@ EOF } oracle_j2re_remove() { - cat << EOF + cat << EOF if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then exit 0 fi diff --git a/lib/oracle-j2sdk-doc.sh b/lib/oracle-j2sdk-doc.sh index 33d27ab..1bcf07f 100644 --- a/lib/oracle-j2sdk-doc.sh +++ b/lib/oracle-j2sdk-doc.sh @@ -9,37 +9,37 @@ oracle_j2sdk_doc_detect() { case "$j2se_release" in 6) # JDK 6 - j2se_expected_min_size=44 #Mb - ;; - *) # JDK 7 and higher - j2se_expected_min_size=290 #Mb - ;; + j2se_expected_min_size=44 #Mb + ;; + *) # JDK 7 and higher + j2se_expected_min_size=290 #Mb + ;; esac - cat << EOF + cat << EOF Detected product: Java(TM) Development Kit (JDK) Documentation Standard Edition, Version $j2se_release Update $j2se_update Oracle(TM) EOF - if read_yn "Is this correct [Y/n]: "; then - j2se_found=true - j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 )) - j2se_vendor="oracle" - j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM) Documentation" + if read_yn "Is this correct [Y/n]: "; then + j2se_found=true + j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 )) + j2se_vendor="oracle" + j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM) Documentation" - j2se_install=oracle_j2sdk_doc_install - j2se_remove=oracle_j2sdk_doc_remove - j2sdk_doc_run - fi + j2se_install=oracle_j2sdk_doc_install + j2se_remove=oracle_j2sdk_doc_remove + j2sdk_doc_run fi + fi } j2se_detect_j2sdk_doc_oracle=oracle_j2sdk_doc_detect oracle_j2sdk_doc_install() { - cat << EOF + cat << EOF if [ ! -e "$javadoc_base$j2se_name" ]; then exit 0 fi @@ -54,7 +54,7 @@ EOF } oracle_j2sdk_doc_remove() { - cat << EOF + cat << EOF if [ ! -e "$javadoc_base$j2se_name" ]; then exit 0 fi diff --git a/lib/oracle-j2sdk.sh b/lib/oracle-j2sdk.sh index b3df6c9..8c10b59 100644 --- a/lib/oracle-j2sdk.sh +++ b/lib/oracle-j2sdk.sh @@ -37,27 +37,27 @@ Detected product: Standard Edition, Version $j2se_release Update $j2se_update Oracle(TM) EOF - if read_yn "Is this correct [Y/n]: "; then - j2se_found=true - j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 )) - j2se_vendor="oracle" - j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)" + if read_yn "Is this correct [Y/n]: "; then + j2se_found=true + j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 )) + j2se_vendor="oracle" + j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)" - j2se_install=oracle_j2sdk_install - j2se_remove=oracle_j2sdk_remove - j2se_jinfo=oracle_j2sdk_jinfo - oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool" - oracle_jre_bin_jre="javaws policytool" - oracle_no_man_jre_bin_jre="ControlPanel" - oracle_jre_lib_hl="jexec" - oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver" - j2sdk_run - fi + j2se_install=oracle_j2sdk_install + j2se_remove=oracle_j2sdk_remove + j2se_jinfo=oracle_j2sdk_jinfo + oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool" + oracle_jre_bin_jre="javaws policytool" + oracle_no_man_jre_bin_jre="ControlPanel" + oracle_jre_lib_hl="jexec" + oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver" + j2sdk_run + fi fi } oracle_j2sdk_install() { - cat << EOF + cat << EOF if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then exit 0 fi @@ -75,7 +75,7 @@ EOF } oracle_j2sdk_remove() { - cat << EOF + cat << EOF if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then exit 0 fi diff --git a/make-jpkg b/make-jpkg index 74c743b..41899db 100755 --- a/make-jpkg +++ b/make-jpkg @@ -40,31 +40,31 @@ if ! dh_testroot >/dev/null 2>&1; then echo "Internal error, fakeroot seems to fail faking root" >&2 exit 1 fi - exec fakeroot "$0" "$@" + exec fakeroot "$0" "$@" fi # check whether I'm real root, and bail out if so... ugly, but needed if touch /lib/.test 2>/dev/null; then - rm -f /lib/.test - echo "You are real root -- unfortunately, some Java distributions have" >&2 - echo "install scripts that directly manipulate /etc, and may cause some" >&2 - echo "inconsistencies on your system. Instead, you should become a" >&2 - echo "non-root user and run:" >&2 - echo >&2 - echo "fakeroot make-jpkg $@" >&2 - echo >&2 - echo "which will allow no damage to be done to your system files and" >&2 - echo "still permit the Java distribution to successfully extract." >&2 - echo >&2 - echo "Aborting." >&2 - exit 1 + rm -f /lib/.test + echo "You are real root -- unfortunately, some Java distributions have" >&2 + echo "install scripts that directly manipulate /etc, and may cause some" >&2 + echo "inconsistencies on your system. Instead, you should become a" >&2 + echo "non-root user and run:" >&2 + echo >&2 + echo "fakeroot make-jpkg $@" >&2 + echo >&2 + echo "which will allow no damage to be done to your system files and" >&2 + echo "still permit the Java distribution to successfully extract." >&2 + echo >&2 + echo "Aborting." >&2 + exit 1 fi ### Parse options print_usage() { - cat << EOF + cat << EOF Usage: $program_name [OPTION]... FILE $program_name builds a Debian package from the given Java binary distribution FILE @@ -108,27 +108,27 @@ EOF # options while [[ $# -gt 0 && "x$1" == x--* ]]; do if [[ "x$1" == x--version ]]; then - echo "make-jpkg $version" - exit 0 + echo "make-jpkg $version" + exit 0 elif [[ "x$1" == x--help ]]; then - print_usage - exit 0 + print_usage + exit 0 elif [[ "x$1" == x--full-name ]]; then - [ $# -le 1 ] && missing_argument "$1" - shift - maintainer_name="$1" + [ $# -le 1 ] && missing_argument "$1" + shift + maintainer_name="$1" elif [[ "x$1" == x--email ]]; then - [ $# -le 1 ] && missing_argument "$1" - shift - maintainer_email="$1" + [ $# -le 1 ] && missing_argument "$1" + shift + maintainer_email="$1" elif [[ "x$1" == x--revision ]]; then - [ $# -le 1 ] && missing_argument "$1" - shift - revision="-${1}" + [ $# -le 1 ] && missing_argument "$1" + shift + revision="-${1}" elif [[ "x$1" == x--changes ]]; then - genchanges="true" + genchanges="true" else - unrecognized_option "$1" + unrecognized_option "$1" fi shift done @@ -166,7 +166,7 @@ tmp= on_exit() { lastcmd="$_" if [[ -z "$success" && -z "$failed" ]]; then - cat >&2 << EOF + cat >&2 << EOF Aborted ($lastcmd). @@ -174,9 +174,9 @@ EOF fi # remove temporary directory if [ -n "$tmp" -a -d "$tmp" ]; then - echo -n "Removing temporary directory: " - rm -rf "$tmp" - echo "done" + echo -n "Removing temporary directory: " + rm -rf "$tmp" + echo "done" fi } trap on_exit EXIT @@ -226,7 +226,7 @@ j2se_found= for var in ${!j2se_detect_*}; do eval "\$$var" if [[ "$j2se_found" == "true" ]]; then - break; + break; fi done echo