mid-kid
6 years ago
2 changed files with 64 additions and 0 deletions
@ -0,0 +1,63 @@ |
|||||
|
#!/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" |
||||
|
xz -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 ' |
||||
|
/sbin/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/lib/pkgtools/setup/setup.$script |
||||
|
done |
||||
|
chroot . /usr/bin/update-gtk-immodules > /dev/null 2>&1 |
||||
|
HOME=/root 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 15.0-current, I'm unsure whether it'll work properly on any other version. |
Loading…
Reference in new issue