diff options
author | Fredrik Rinnestam <fredrik@crux.nu> | 2017-02-23 18:24:27 +0100 |
---|---|---|
committer | Fredrik Rinnestam <fredrik@crux.nu> | 2017-02-23 18:24:27 +0100 |
commit | e5c99f7b1a729016c689f240c69b8b2bdc4ed4aa (patch) | |
tree | 8025f5ecd02835f38eebd397225183112c003cce | |
parent | 8db4bc01e22cf91aa6b9022a41bd25ae8c80f132 (diff) | |
download | pkgutils-e5c99f7b1a729016c689f240c69b8b2bdc4ed4aa.tar.gz pkgutils-e5c99f7b1a729016c689f240c69b8b2bdc4ed4aa.tar.xz |
Fixed various style errors and some typos. Patch by Camille (onodera).
-rwxr-xr-x | pkgmk.in | 152 |
1 files changed, 75 insertions, 77 deletions
@@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # @@ -116,7 +116,7 @@ download_file() { LOCAL_FILENAME=`get_filename $1` LOCAL_FILENAME_PARTIAL="$LOCAL_FILENAME.partial" - + case ${PKGMK_DOWNLOAD_PROG} in curl) RESUME_CMD="-C -" @@ -161,12 +161,12 @@ download_file() { fi done fi - + if [ $error != 0 -o ! -f "$LOCAL_FILENAME_PARTIAL" ]; then error "Downloading '$1' failed." exit $E_DOWNLOAD fi - + mv -f "$LOCAL_FILENAME_PARTIAL" "$LOCAL_FILENAME" } @@ -193,7 +193,7 @@ download_source() { unpack_source() { local FILE LOCAL_FILENAME COMMAND - + for FILE in ${source[@]}; do LOCAL_FILENAME=`get_filename $FILE` case $LOCAL_FILENAME in @@ -219,12 +219,12 @@ unpack_source() { make_md5sum() { local FILE LOCAL_FILENAMES - + if [ "$source" ]; then for FILE in ${source[@]}; do LOCAL_FILENAMES="$LOCAL_FILENAMES `get_filename $FILE`" done - + md5sum $LOCAL_FILENAMES | sed -e 's| .*/| |' | sort -k 2 fi } @@ -273,7 +273,7 @@ check_md5sum() { info "Md5sum not found." exit $E_MD5 fi - + warning "Md5sum not found, creating new." make_md5sum > $PKGMK_MD5SUM fi @@ -310,7 +310,6 @@ check_signature() { cd $PKGMK_ROOT if [ $RESULT -ne 0 ]; then - if [ "$err" = "signify: signature verification failed" ]; then error "Failed verifying cryptographic digest" else @@ -324,15 +323,14 @@ check_signature() { error "Building '$TARGET' failed." exit $E_SIGNATURE - #else - #info "Signature verification succeeded." + #else + #info "Signature verification succeeded." fi else - if [ "$PKGMK_IGNORE_MD5SUM" = "no" ] && [ "$PKGMK_CHECK_SIGNATURE" = "no" ]; then - warning "Signature file not found, falling back to old md5sum checking." - return 0; - fi - + if [ "$PKGMK_IGNORE_MD5SUM" = "no" ] && [ "$PKGMK_CHECK_SIGNATURE" = "no" ]; then + warning "Signature file not found, falling back to old md5sum checking." + return 0; + fi if [ "$PKGMK_CHECK_SIGNATURE" = "yes" ]; then if [ "$PKGMK_KEEP_WORK" = "no" ]; then rm -rf $PKGMK_WORK_DIR @@ -391,33 +389,33 @@ make_signature() { } refresh_signature() { - if [ ! "$PKGMK_PRIVATEKEY" ]; then - REPO=${PWD%/*} - REPO=${REPO##*/} - REPO=${REPO%.git} - fi + if [ ! "$PKGMK_PRIVATEKEY" ]; then + REPO=${PWD%/*} + REPO=${REPO##*/} + REPO=${REPO%.git} + fi - if [ "$REPO" ]; then - PKGMK_PRIVATEKEY="/etc/ports/${REPO}.sec" - fi + if [ "$REPO" ]; then + PKGMK_PRIVATEKEY="/etc/ports/${REPO}.sec" + fi - tail -n +3 ${PKGMK_SIGNATURE} | \ - signify -S -e -x - -q -s "$PKGMK_PRIVATEKEY" -m - > ${PKGMK_SIGNATURE}.tmp + tail -n +3 ${PKGMK_SIGNATURE} | \ + signify -S -e -x - -q -s "$PKGMK_PRIVATEKEY" -m - > ${PKGMK_SIGNATURE}.tmp - if [ $? -ne 0 ]; then - rm ${PKGMK_SIGNATURE}.tmp - error "Refreshing signature failed" - exit $E_SIGNATURE - else - mv ${PKGMK_SIGNATURE}.tmp ${PKGMK_SIGNATURE} - fi + if [ $? -ne 0 ]; then + rm ${PKGMK_SIGNATURE}.tmp + error "Refreshing signature failed" + exit $E_SIGNATURE + else + mv ${PKGMK_SIGNATURE}.tmp ${PKGMK_SIGNATURE} + fi } strip_files() { local FILE FILTER - + cd $PKG - + if [ -f $PKGMK_ROOT/$PKGMK_NOSTRIP ]; then FILTER="grep -v -f $PKGMK_ROOT/$PKGMK_NOSTRIP" else @@ -442,13 +440,13 @@ compress_manpages() { local FILE DIR TARGET cd $PKG - + find . -type f -path "*/man/man*/*" | while read FILE; do if [ "$FILE" = "${FILE%%.gz}" ]; then gzip -9 "$FILE" fi done - + find . -type l -path "*/man/man*/*" | while read FILE; do TARGET=`readlink -n "$FILE"` TARGET="${TARGET##*/}" @@ -465,9 +463,9 @@ compress_manpages() { check_footprint() { local FILE="$PKGMK_WORK_DIR/.tmp" - + cd $PKGMK_ROOT - + if [ -f $TARGET ]; then make_footprint > $FILE.footprint if [ -f $PKGMK_FOOTPRINT ]; then @@ -502,7 +500,7 @@ make_work_dir() { export PKG="$PKGMK_WORK_DIR/pkg" export SRC="$PKGMK_WORK_DIR/src" umask 022 - + cd $PKGMK_ROOT remove_work_dir mkdir -p $SRC $PKG @@ -524,28 +522,28 @@ remove_work_dir() { build_package() { local BUILD_SUCCESSFUL="no" local COMPRESSION - + check_file "$TARGET" make_work_dir if [ "$UID" != "0" ]; then warning "Packages should be built as root." fi - + info "Building '$TARGET'." - + unpack_source - + cd $SRC (set -e -x ; build) - + if [ $? = 0 ]; then if [ "$PKGMK_NO_STRIP" = "no" ]; then strip_files fi - + compress_manpages - + cd $PKG info "Build result:" @@ -566,11 +564,11 @@ build_package() { fi fi fi - + if [ "$PKGMK_KEEP_WORK" = "no" ]; then remove_work_dir fi - + if [ "$BUILD_SUCCESSFUL" = "yes" ]; then info "Building '$TARGET' succeeded." else @@ -584,19 +582,19 @@ build_package() { install_package() { local COMMAND - + info "Installing '$TARGET'." - + if [ "$PKGMK_INSTALL" = "install" ]; then COMMAND="pkgadd $TARGET" else COMMAND="pkgadd -u $TARGET" fi - + cd $PKGMK_ROOT echo "$COMMAND" $COMMAND - + if [ $? = 0 ]; then info "Installing '$TARGET' succeeded." else @@ -607,9 +605,9 @@ install_package() { recursive() { local ARGS FILE DIR - + ARGS=`echo "$@" | sed -e "s/--recursive//g" -e "s/-r//g"` - + for FILE in `find $PKGMK_ROOT -name $PKGMK_PKGFILE | sort`; do DIR="`dirname $FILE`/" if [ -d $DIR ]; then @@ -622,12 +620,12 @@ recursive() { clean() { local FILE LOCAL_FILENAME - + if [ -f $TARGET ]; then info "Removing $TARGET" rm -f $TARGET fi - + for FILE in ${source[@]}; do LOCAL_FILENAME=`get_filename $FILE` if [ -e $LOCAL_FILENAME ] && [ "$LOCAL_FILENAME" != "$FILE" ]; then @@ -642,17 +640,17 @@ update_footprint() { error "Unable to update footprint. File '$TARGET' not found." exit 1 fi - + check_file "$PKGMK_FOOTPRINT" make_footprint > $PKGMK_FOOTPRINT touch $TARGET - + info "Footprint updated." } build_needed() { local FILE RESULT - + RESULT="yes" if [ -f $TARGET ]; then RESULT="no" @@ -664,18 +662,18 @@ build_needed() { fi done fi - + echo $RESULT } interrupted() { echo "" error "Interrupted." - + if [ "$PKGMK_KEEP_WORK" = "no" ]; then rm -rf $PKGMK_WORK_DIR fi - + exit 1 } @@ -706,7 +704,7 @@ print_help() { echo " -c, --clean remove package and downloaded files" echo " -kw, --keep-work keep temporary working directory" echo " -cf, --config-file <file> use alternative configuration file" - echo " -v, --version print version and exit " + echo " -v, --version print version and exit" echo " -h, --help print help and exit" } @@ -799,14 +797,14 @@ main() { fi local FILE TARGET - + parse_options "$@" - + if [ "$PKGMK_RECURSIVE" = "yes" ]; then recursive "$@" exit 0 fi - + for FILE in $PKGMK_PKGFILE $PKGMK_CONFFILE; do if [ ! -f $FILE ]; then error "File '$FILE' not found." @@ -814,11 +812,11 @@ main() { fi . $FILE done - + check_directory "$PKGMK_SOURCE_DIR" check_directory "$PKGMK_PACKAGE_DIR" check_directory "`dirname $PKGMK_WORK_DIR`" - + check_pkgfile case $PKGMK_COMPRESSION_MODE in @@ -835,12 +833,12 @@ main() { clean exit 0 fi - + if [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ]; then update_footprint exit 0 fi - + if [ "$PKGMK_UPDATE_MD5SUM" = "yes" ]; then download_source check_file "$PKGMK_MD5SUM" @@ -848,7 +846,7 @@ main() { info "Md5sum updated." exit 0 fi - + if [ "$PKGMK_UPDATE_SIGNATURE" = "yes" ]; then download_source check_file "$PKGMK_SIGNATURE" @@ -868,7 +866,7 @@ main() { download_source exit 0 fi - + if [ "$PKGMK_EXTRACT_ONLY" = "yes" ]; then download_source make_work_dir @@ -876,7 +874,7 @@ main() { unpack_source exit 0 fi - + if [ "$PKGMK_UP_TO_DATE" = "yes" ]; then if [ "`build_needed`" = "yes" ]; then info "Package '$TARGET' is not up to date." @@ -885,18 +883,18 @@ main() { fi exit 0 fi - + if [ "`build_needed`" = "no" ] && [ "$PKGMK_FORCE" = "no" ] && [ "$PKGMK_CHECK_MD5SUM" = "no" ] && [ "$PKGMK_CHECK_SIGNATURE" = "no" ]; then info "Package '$TARGET' is up to date." else download_source build_package fi - + if [ "$PKGMK_INSTALL" != "no" ]; then install_package fi - + exit 0 } |