additional bash programming to support a json configuration file.
still working on kernel options for proper networking.
This commit is contained in:
44
scripts/build_filesystem.sh
Executable file
44
scripts/build_filesystem.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "switching from $(id -un) to root"
|
||||
exec sudo "$0" "$@"
|
||||
fi
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
DIR="$(dirname "$0")"
|
||||
cd ..
|
||||
echo $PWD
|
||||
if mountpoint -q "./outputs/chroot/proc/"; then
|
||||
umount -lf "./outputs/chroot/proc/"
|
||||
fi
|
||||
rm -rf './outputs/chroot'
|
||||
mkdir -p ./outputs/chroot/
|
||||
if mountpoint -q "./outputs/root/proc/"; then
|
||||
umount -lf "./outputs/root/proc/"
|
||||
fi
|
||||
rsync -a ./outputs/root/ ./outputs/chroot/
|
||||
mkdir -p ./outputs/chroot/proc
|
||||
mount --bind /proc ./outputs/chroot/proc
|
||||
cp ./config/filesystem_chroot_install.sh ./outputs/chroot/filesystem_chroot_install.sh
|
||||
cp ./config/apply_initial_host_configuration.sh ./outputs/chroot/apply_initial_host_configuration.sh
|
||||
cp ./config/config.json ./outputs/chroot/config.json
|
||||
|
||||
#setup user skeleton
|
||||
cp ./config/settings/skel/bash_profile ./outputs/chroot/etc/skel/.bash_profile
|
||||
cp ./config/settings/skel/bashrc ./outputs/chroot/etc/skel/.bashrc
|
||||
cp ./config/settings/skel/profile ./outputs/chroot/etc/skel/.profile
|
||||
|
||||
chmod +x ./outputs/chroot/filesystem_chroot_install.sh
|
||||
chmod +x ./outputs/chroot/apply_initial_host_configuration.sh
|
||||
chroot ./outputs/chroot /bin/bash -c "/filesystem_chroot_install.sh"
|
||||
chroot ./outputs/chroot /bin/bash -c "/apply_initial_host_configuration.sh"
|
||||
|
||||
|
||||
|
||||
cd $DIR
|
||||
cd ..
|
||||
if mountpoint -q "./outputs/chroot/proc/"; then
|
||||
umount -lf "./outputs/chroot/proc/"
|
||||
fi
|
||||
echo 'root filesystem created.'
|
||||
Reference in New Issue
Block a user