X-Git-Url: http://gitweb/?a=blobdiff_plain;f=pkgmk.in;h=b8e3e4e1957086b9b255e31973dfdb64f8a5206d;hb=780862a6ece30840523d91328f1945cf3edf2cfe;hp=2358de08988050a83dbed0e4ad584422b7e72268;hpb=7b8b79b9c200c91b43c3ee8f0cf202f7a4021f79;p=pkgutils-cross.git diff --git a/pkgmk.in b/pkgmk.in index 2358de0..b8e3e4e 100755 --- a/pkgmk.in +++ b/pkgmk.in @@ -75,6 +75,13 @@ check_directory() { fi } +check_file() { + if [ -e $1 ] && [ ! -w $1 ]; then + error "File '$1' is not writable." + exit 1 + fi +} + download_file() { info "Downloading '$1'." @@ -155,8 +162,8 @@ unpack_source() { for FILE in ${source[@]}; do LOCAL_FILENAME=`get_filename $FILE` case $LOCAL_FILENAME in - *.tar.gz|*.tar.Z|*.tgz|*.tar.bz2|*.tar.xz|*.zip) - COMMAND="bsdtar -C $SRC -xf $LOCAL_FILENAME" ;; + *.tar.gz|*.tar.Z|*.tgz|*.tar.bz2|*.tbz2|*.tar.xz|*.txz|*.tar.lzma|*.zip|*.rpm) + COMMAND="bsdtar -p -o -C $SRC -xf $LOCAL_FILENAME" ;; *) COMMAND="cp $LOCAL_FILENAME $SRC" ;; esac @@ -347,6 +354,7 @@ remove_work_dir() { build_package() { local BUILD_SUCCESSFUL="no" + check_file "$TARGET" make_work_dir if [ "$UID" != "0" ]; then @@ -458,6 +466,7 @@ update_footprint() { exit 1 fi + check_file "$PKGMK_FOOTPRINT" make_footprint > $PKGMK_FOOTPRINT touch $TARGET @@ -612,6 +621,7 @@ main() { if [ "$PKGMK_UPDATE_MD5SUM" = "yes" ]; then download_source + check_file "$PKGMK_MD5SUM" make_md5sum > $PKGMK_MD5SUM info "Md5sum updated." exit 0