summaryrefslogtreecommitdiffstats
path: root/makemod
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2015-11-28 01:52:06 +0100
committer Eric Hameleers <alien@slackware.com>2015-11-28 01:52:06 +0100
commit4d5cdc379e338c1c28f4d7d09226d4167a3f9e1e (patch)
tree95eba4e47f473c238361f19750cbd7d392a333e1 /makemod
downloadliveslak-4d5cdc379e338c1c28f4d7d09226d4167a3f9e1e.tar.gz
liveslak-4d5cdc379e338c1c28f4d7d09226d4167a3f9e1e.tar.xz
Slackware Live Edition: initial commit.Beta2
This is Beta 2. Read http://alien.slackbook.org/blog/slackware-live-edition-beta-2 for all the details.
Diffstat (limited to 'makemod')
-rwxr-xr-xmakemod48
1 files changed, 48 insertions, 0 deletions
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) <packagename|directory> 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
+