diff options
Diffstat (limited to '')
-rwxr-xr-x | makemod | 58 |
1 files changed, 55 insertions, 3 deletions
@@ -2,10 +2,62 @@ # Create squashfs module from a directory or a Slackware package. # Module can then be added to liveslak/addons directory. +# By default, overwrite destination module file without asking if it pre-exists. +INTERACTIVE=NO + +function help() { + cat <<EOH + +-- Usage: + $(basename $0) [-i] <packagename|directory> modulename.sxz +-- Option parameters: + h : This help. + i : Interactive mode will not overwrite destination file by default. +-- Description: + The first parameter is either the full path to a Slackware package, + or else a directory. + If a packagename is supplied as first parameter, it will be installed + into a temporary directory using Slackware's "installpkg". + The content of the temporary directory will be squashed into a module + by the "squashfs" program. + If a directoryname is supplied, its content will be squashed into + a module by the "squashfs" program. + The second parameter is the full pathname of the output module + which will be created. + +EOH +} + +# Option parsing: +while getopts "hi" Option +do + case $Option in + h ) help; exit + ;; + i ) INTERACTIVE="YES" + ;; + * ) help; exit + ;; # DEFAULT + esac +done +shift $(($OPTIND - 1)) +# End of option parsing. +# $1 now references the first non option item supplied on the command line +# --------------------------------------------------------------------------- + +# Input check: if [ "x$1" = "x" ]; then - echo "-- Usage:" - echo " $(basename $0) <packagename|directory> modulename.sxz" + help + exit 1 +elif [ "x$2" = "x" ]; then + help exit 1 +elif [ -f "$2" -a "$INTERACTIVE" = "YES" ]; then + read -p "-- Destination file '$2' already exists. Overwrite Y/N (y): " ANSWER + if [ "x$ANSWER" = "xN" -o "x$ANSWER" = "xn" ]; then + echo "-- Aborting now." + exit + fi fi # .sxz extension uses xz compression: @@ -37,7 +89,7 @@ else fi fi -mksquashfs "${PKGDIR}" "$2" -comp ${COMPR} -b 256K $3 $4 $5 $6 $7 $8 $9 +mksquashfs "${PKGDIR}" "$2" -noappend -comp ${COMPR} -b 256K $3 $4 $5 $6 $7 $8 $9 if [ $? -ne 0 ]; then echo "-- Error creating squashfs compressed module" exit 1 |