summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Daubert <jue@jue.li>2009-07-15 20:01:53 +0200
committerTilman Sauerbeck <tilman@crux.nu>2009-07-15 20:01:53 +0200
commitde428c293b6157635965227c8f9f2296db83d54f (patch)
tree4a7c9165c90919c7dfbb3050f41d82ba207ab103
parent7b8b79b9c200c91b43c3ee8f0cf202f7a4021f79 (diff)
downloadpkgutils-de428c293b6157635965227c8f9f2296db83d54f.tar.gz
pkgutils-de428c293b6157635965227c8f9f2296db83d54f.tar.xz
Bug #360: Check whether files are writable early.
-rwxr-xr-xpkgmk.in10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgmk.in b/pkgmk.in
index 2358de08..0c826ac0 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'."
@@ -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

Generated by cgit