.TP
.B "wget"
Used by pkgmk to download source code.
+.SH EXIT CODES
+.TP
+.B 0
+No error occured.
+.TP
+.B 1
+A general error has occured.
+.TP
+.B 2
+The Pkgfile is invalid.
+.TP
+.B 3
+The source or build directory is missing or is lacking read/write permissions.
+.TP
+.B 4
+An error occured during the download of source files.
+.TP
+.B 5
+An error occured during unpacking of source files.
+.TP
+.B 6
+An md5sum mismatch occured.
+.TP
+.B 7
+A footprint mismatch occured.
+.TP
+.B 8
+An error occured while running the build function.
+.TP
+.B 9
+An error occured while installing the package via pkgadd.
.SH SEE ALSO
pkgmk.conf(5), pkgadd(8), pkgrm(8), pkginfo(8), rejmerge(8), wget(1)
.SH COPYRIGHT
# USA.
#
+##
+# error codes
+E_GENERAL=1
+E_PKGFILE=2 # invalid Pkgfile
+E_DIR_PERM=3 # (source/build) directory missing or missing read/write permission
+E_DOWNLOAD=4 # error during download
+E_UNPACK=5 # error during unpacking of source file(s)
+E_MD5=6 # md5sum verification failed
+E_FOOTPRINT=7 # footprint check failure
+E_BUILD=8 # error while running 'build()'
+E_INSTALL=9 # error while installing the package via 'pkgadd'
+
info() {
echo "=======> $1"
}
check_pkgfile() {
if [ ! "$name" ]; then
error "Variable 'name' not specified in $PKGMK_PKGFILE."
- exit 1
+ exit $E_PKGFILE
elif [ ! "$version" ]; then
error "Variable 'version' not specified in $PKGMK_PKGFILE."
- exit 1
+ exit $E_PKGFILE
elif [ ! "$release" ]; then
error "Variable 'release' not specified in $PKGMK_PKGFILE."
- exit 1
+ exit $E_PKGFILE
elif [ "`type -t build`" != "function" ]; then
error "Function 'build' not specified in $PKGMK_PKGFILE."
- exit 1
+ exit $E_PKGFILE
fi
}
check_directory() {
if [ ! -d $1 ]; then
error "Directory '$1' does not exist."
- exit 1
+ exit $E_DIR_PERM
elif [ ! -w $1 ]; then
error "Directory '$1' not writable."
- exit 1
+ exit $E_DIR_PERM
elif [ ! -x $1 ] || [ ! -r $1 ]; then
error "Directory '$1' not readable."
- exit 1
+ exit $E_DIR_PERM
fi
}
if [ ! "`type -p wget`" ]; then
error "Command 'wget' not found."
- exit 1
+ exit $E_GENERAL
fi
LOCAL_FILENAME=`get_filename $1`
if [ $error != 0 ]; then
error "Downloading '$1' failed."
- exit 1
+ exit $E_DOWNLOAD
fi
mv -f "$LOCAL_FILENAME_PARTIAL" "$LOCAL_FILENAME"
if [ ! -e $LOCAL_FILENAME ]; then
if [ "$LOCAL_FILENAME" = "$FILE" ]; then
error "Source file '$LOCAL_FILENAME' not found (can not be downloaded, URL not specified)."
- exit 1
+ exit $E_DOWNLOAD
else
if [ "$PKGMK_DOWNLOAD" = "yes" ]; then
download_file $FILE
else
error "Source file '$LOCAL_FILENAME' not found (use option -d to download)."
- exit 1
+ exit $E_DOWNLOAD
fi
fi
fi
rm -rf $PKGMK_WORK_DIR
fi
error "Building '$TARGET' failed."
- exit 1
+ exit $E_UNPACK
fi
done
}
if [ "$PKGMK_CHECK_MD5SUM" = "yes" ]; then
error "Md5sum not ok."
- exit 1
+ exit $E_MD5
fi
error "Building '$TARGET' failed."
- exit 1
+ exit $E_MD5
fi
else
if [ "$PKGMK_CHECK_MD5SUM" = "yes" ]; then
rm -rf $PKGMK_WORK_DIR
fi
info "Md5sum not found."
- exit 1
+ exit $E_MD5
fi
warning "Md5sum not found, creating new."