1
0
Fork 0
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.

45 lines
1.3 KiB

#!/usr/bin/env bash
set -x
source /etc/os-release
if [ ! ${ID} == "debian" ]
then
echo "This is only tested on Debian. Please use a VM is necessary."
exit 1
fi
if [ ${EUID} -ne 0 ]
then
echo "Please run as root, tested with \`sudo\`"
exit 1
fi
DOTFILE_DIRECTORY=temp_dots
CHROOT_DIRECTORY=temp_chroot_dir
DEBIAN_VERSION=unstable
LOGIN_SCRIPT=setup-scripts/login-script.sh
NETWORK_SCRIPT=setup-scripts/network-setup.sh
# start clean
rm -rf ${CHROOT_DIRECTORY} ${DOTFILE_DIRECTORY}
mkdir -p ${CHROOT_DIRECTORY}
# bootstrap
debootstrap --arch=riscv64 --keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg --include=debian-ports-archive-keyring ${DEBIAN_VERSION} ${CHROOT_DIRECTORY} http://deb.debian.org/debian-ports
# copy bootstrap script to the chroot dir
cp chroot-setup.sh ${CHROOT_DIRECTORY}/chroot-setup.sh
# chroot in dir and exec my script
chroot ${CHROOT_DIRECTORY} bash chroot-setup.sh
# copy bashrc to /etc/bash.bashrc
git clone --depth 1 https://git.thefossguy.com/thefossguy/dots-vidhyaa.git ${DOTFILE_DIRECTORY}
cp ${DOTFILE_DIRECTORY}/.bashrc ${CHROOT_DIRECTORY}/etc/bash.bashrc
cp ${LOGIN_SCRIPT} ${CHROOT_DIRECTORY}/root/.bashrc
cp ${NETWORK_SCRIPT} ${CHROOT_DIRECTORY}/root/network-setup.sh
# create an image
bash mk-img.sh ${DEBIAN_VERSION}