blob: 4cc9c26e46c6d3d9eab690109cb6e418844532e6 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
|