You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.8 KiB
63 lines
1.8 KiB
#!/bin/sh -e
|
|
set -e
|
|
|
|
if [ "$(id -u)" != 0 ]; then
|
|
echo "This script needs root permissions!" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$#" -lt 2 ]; then
|
|
echo "Usage: $0 <slackware> <chroot>" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
slackware="$(realpath "$1")"
|
|
chroot="$(realpath "$2")"
|
|
|
|
temp="$(mktemp -d -t makechroot.XXXXXX)"
|
|
|
|
# Make sure we clean up properly before exitting
|
|
cleanup() {
|
|
mountpoint -q "$temp/mnt" && umount "$temp/mnt"
|
|
mountpoint -q "$temp/dvd" && umount "$temp/dvd"
|
|
rm -rf "$temp"
|
|
}
|
|
trap 'cleanup' EXIT
|
|
|
|
# Extract the initrd
|
|
cd "$temp"
|
|
gzip -cd "$slackware/isolinux/initrd.img" | cpio -id
|
|
|
|
# Mount the dvd
|
|
mkdir dvd
|
|
mount --bind "$slackware" dvd
|
|
|
|
# Mount the destination
|
|
mkdir -p "$chroot"
|
|
mount --bind "$chroot" mnt
|
|
|
|
# Install the packages
|
|
env -i chroot . sh -l -c '
|
|
/usr/lib/setup/installpkg --root /mnt --terse /dvd/slackware*/*/*.t?z
|
|
|
|
cd /mnt
|
|
for script in \
|
|
04.mkfontdir \
|
|
05.fontconfig \
|
|
07.update-desktop-database \
|
|
07.update-mime-database \
|
|
08.gtk-update-icon-cache \
|
|
11.cacerts \
|
|
cups-genppdupdate
|
|
do
|
|
var/log/setup/setup.$script
|
|
done
|
|
chroot . /usr/bin/update-gtk-immodules > /dev/null 2>&1
|
|
chroot . /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1
|
|
chroot . /usr/bin/update-pango-querymodules > /dev/null 2>&1
|
|
chroot . /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas > /dev/null 2>&1
|
|
'
|
|
# We only run a few setup scripts that do not require user interaction, and deal with updating caches and such, which is not done (properly) by the doinst.sh scripts.
|
|
# To get a full list, run: bzcat MANIFEST.bz2 | awk '{print $6}' | grep '^var/log/setup/setup\.' | sort
|
|
# Besides the setup scripts, we also need to run some programs which are usually ran from /etc/rc.d/rc.M, but not from the setup scripts.
|
|
# This is tailored to Slackware 14.2. I'm unsure whether it'll work properly on any other version.
|
|
|