add scripts
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
parent
0c4fb85a8d
commit
3d24308976
2 changed files with 84 additions and 0 deletions
48
enter-chrooted-slackware.sh
Executable file
48
enter-chrooted-slackware.sh
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# # Exit if location not specified
|
||||
# if [ -z "$1" ]; then
|
||||
# echo "chroot folder not specified"
|
||||
# exit 1
|
||||
# elif [ "$1" = -h ]; then
|
||||
# echo "./chroot.sh <chroot-folder>"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
location=${1:-$(dirname $(realpath $0))/chrooted-slackware/}
|
||||
echo "$location"
|
||||
cd "$location"
|
||||
|
||||
# Mounting, basic
|
||||
sudo mount -t proc proc "$location"/proc || exit 1
|
||||
sudo mount -o bind /sys "$location"/sys || exit 1
|
||||
sudo mount -o bind /dev "$location"/dev || exit 1
|
||||
sudo mount -o bind /mnt/backup "$location"/mnt/backup || exit 1
|
||||
sudo mount -o bind /home/installs "$location"/home/installs || exit 1
|
||||
|
||||
mkdir -p "$location"/var/lib/sbopkg/
|
||||
rsync -Ha --delete --info=progress2 /var/lib/sbopkg/ "$location"/var/lib/sbopkg/
|
||||
|
||||
# Mounting extra partition which is already mounted on host
|
||||
# first one is host mount path, second is chroot mount
|
||||
#sudo mount -B /mnt/datalinux2 "$1"/mnt/data
|
||||
|
||||
# For internet access
|
||||
sudo cp /etc/resolv.conf "$location"/etc/resolv.conf
|
||||
|
||||
# Finally, chroot
|
||||
# Need to ensure correct variables
|
||||
# http://www.iitk.ac.in/LDP/LDP/lfs/5.0/html/chapter06/chroot.html
|
||||
sudo chroot "$location" \
|
||||
/usr/bin/env -i \
|
||||
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
|
||||
/bin/bash --login
|
||||
|
||||
# Unmounting after exit from chroot
|
||||
#sudo umount "$location"/mnt/data
|
||||
sudo umount "$location"/{proc,sys,dev,mnt/backup,home/installs}/ || exit 1
|
||||
|
||||
echo "Done"
|
36
install-chrooted-slackware.sh
Executable file
36
install-chrooted-slackware.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
location=${1:-$(dirname $(realpath $0))/chrooted-slackware}
|
||||
echo "$location"
|
||||
repo=${2:-/home/installs/mirrors/slackware64-current/slackware64}
|
||||
|
||||
[ -e "$location" ] && rm -r "$location"
|
||||
mkdir -p "$location"
|
||||
|
||||
sudo installpkg --terse --root "$location" "$repo"/*/*.t?z
|
||||
|
||||
cat <<EOF > "$location"/etc/fstab
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
tmpfs /dev/shm tmpfs defaults 0 0
|
||||
devpts /dev/pts devpts noexec,nosuid,gid=tty,mode=0620 0 0
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
proc /proc proc defaults 0 0
|
||||
EOF
|
||||
|
||||
# slackware repo
|
||||
mkdir -p "$location"/home/installs/mirrors/
|
||||
cp -a "$repo"/../../slackware64-current/ "$location"/home/installs/mirrors/
|
||||
cat <<EOF > "$location"/etc/slackpkg/mirrors
|
||||
file://home/installs/mirrors/slackware64-current/
|
||||
EOF
|
||||
|
||||
# sbopkg
|
||||
sudo installpkg --terse --root "$location" /home/installs/PKGs/x86_64/sbopkg-*.tgz
|
||||
rsync -Ha --delete {,"$location"}/var/lib/sbopkg/
|
||||
cat <<EOF > "$location"/root/.sbopkg.conf
|
||||
REPO_NAME=SBo-git
|
||||
REPO_BRANCH=current
|
||||
EOF
|
Loading…
Reference in a new issue