Created
March 23, 2020 14:46
-
-
Save rrottmann/6a39929e40063556ab8ca826a9da5d85 to your computer and use it in GitHub Desktop.
apt2sb.sh Skript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# From: https://groups.google.com/forum/#!searchin/slax-users/chroot%7Csort:date/slax-users/3nsx5a8bu8s/UCZpn6X2BgAJ | |
TMP=/tmp/tmpfs$$ | |
CHANGES=$TMP/changes | |
UNION=$TMP/union | |
BUNDLES=/run/initramfs/memory/bundles/ | |
INSTALL="$1" | |
[ -n "$INSTALL" ] || exit | |
mkdir -p $TMP | |
mount -t tmpfs tmpfs $TMP | |
mkdir -p $CHANGES | |
mkdir -p $UNION | |
mount -t aufs -o xino=$TMP/.xino,trunc_xino,br=$CHANGES aufs $UNION | |
# I don't use chromium so filter it out. | |
\ls -1d $BUNDLES[0-1]* | grep -v chromium | while read MOD; do | |
mount -o remount,add:1:$BUNDLES/$(basename $MOD)=ro aufs $UNION | |
done | |
for d in boot dev proc sys tmp media mnt run; do | |
mkdir -p $UNION/$d | |
done | |
chmod ugo+rwx $UNION/tmp | |
mount --bind /dev $UNION/dev | |
mount --bind /proc $UNION/proc | |
mount --bind /sys $UNION/sys | |
echo "apt-get update; apt-get install --yes $INSTALL" >$UNION/doit | |
chmod ugo+x $UNION/doit | |
cp /etc/resolv.conf $UNION/etc/ | |
chroot $UNION /doit | |
umount $UNION/sys | |
umount $UNION/proc | |
umount $UNION/dev | |
rm $CHANGES/doit | |
rmdir $CHANGES/* 2>/dev/null | |
savechanges /"$INSTALL".sb $CHANGES | |
umount $UNION | |
umount $TMP | |
rmdir $TMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment