From 4d5cdc379e338c1c28f4d7d09226d4167a3f9e1e Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sat, 28 Nov 2015 01:52:06 +0100 Subject: Slackware Live Edition: initial commit. This is Beta 2. Read http://alien.slackbook.org/blog/slackware-live-edition-beta-2 for all the details. --- makemod | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 makemod (limited to 'makemod') diff --git a/makemod b/makemod new file mode 100755 index 0000000..4cc9c26 --- /dev/null +++ b/makemod @@ -0,0 +1,48 @@ +#!/bin/sh +# Create squashfs module from a directory or a Slackware package. +# Module can then be added to liveslak/addons directory. + +if [ "x$1" = "x" ]; then + echo "-- Usage:" + echo " $(basename $0) modulename.sxz" + exit 1 +fi + +# .sxz extension uses xz compression: +COMPR="xz" + +if [ -d "$1" ]; then + echo "Creating .sxz from directory." + PKGDIR="$1" +else + MODEXT=$(echo "$2" |rev |cut -d'.' -f1 |rev) + case $MODEXT in + sxz) COMPR="xz" ;; + sgz) COMPR="gzip" ;; + xzm) COMPR="xz" ;; + *) echo "-- Unsupported module extension '$MODEXT'" ; exit 1 ;; + esac + echo "Creating .${MODEXT} from package." + TMPDIR=$(mktemp -t -d makesxz.XXXXXX) + PKGDIR="$TMPDIR" + if [ ! -d $PKGDIR ]; then + echo "-- Failed to create temporary directory for extraction!" + exit 1 + fi + # Extract the package: + /sbin/installpkg -root $PKGDIR "$1" + if [ $? -ne 0 ]; then + echo "-- Error installing package!" + exit 1 + fi +fi + +mksquashfs "${PKGDIR}" "$2" -comp ${COMPR} -b 256K $3 $4 $5 $6 $7 $8 $9 +if [ $? -ne 0 ]; then + echo "-- Error creating squashfs compressed module" + exit 1 +fi + +# If we extracted a package, clean up now: +[ ! -z "$TMPDIR" ] && rm -rf $TMPDIR + -- cgit v1.2.3