#!/bin/bash # Todo: # - Add error handling for each step read -p "Gibson Share Password: " GIBSON_PASS HDOS_ROOT=/opt/hdos if [ -d ${HDOS_ROOT} ]; then rm -rf ${HDOS_ROOT} fi if [ "$(id -u)" -ne 0 ]; then echo "This script must be run as root" exit 1 fi #Default repo hits load balancer backend error, so we manually replace it sed -i 's/http:\/\/http\.kali\.org\/kali/https:\/\/kali.mirror.rafal.ca\/kali/g' export DEBIAN_FRONTEND=noninteractive export NEEDRESTART_MODE=a apt install git sudo curl wget zsh -yqq git clone https://git.corrupt.link/liz/hdos.git ${HDOS_ROOT} chmod -R 766 ${HDOS_ROOT} chmod +x ${HDOS_ROOT}/scripts/* apt update apt full-upgrade -yqq PACKAGE_LIST=$(cat ${HDOS_ROOT}/lists/apt-packages) apt-get install -yqm "$PACKAGE_LIST" apt autoremove -y cat ${HDOS_ROOT}/dotfiles/rc_addition >>/home/hacdc/.zshrc groupadd --gid 1900 classroom usermod -aG classroom hacdc useradd -m -s /usr/bin/zsh -G dialout,cdrom,floppy,audio,video,wireshark,classroom guest cp /home/hacdc/.zshrc /home/guest/.zshrc chown guest:guest /home/guest/.zshrc echo "guest:h4cdch4cdch4cdc" | chpasswd # TODO: fix this to actually run as each user # sudo -u hacdc curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash # sudo -u hacdc curl -fsSL https://pyenv.run | bash # # sudo -u guest curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash # sudo -u guest curl -fsSL https://pyenv.run | bash # Generate GPG framework sudo -u hacdc gpg --list-keys sudo -u guest gpg --list-keys gpg --list-keys # Setup Flatpak flatpak remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak update -y while read P; do flatpak install -y --noninteractive "$P" done <${HDOS_ROOT}/lists/flatpak-packages # Setup Shared Directory SHARED_DIR=/mnt/gibson if [ ! -d ${SHARED_DIR} ]; then mkdir -p ${SHARED_DIR} cat ${HDOS_ROOT}/dotfiles/gibson >/etc/gibson chmod 600 /etc/gibson cat ${HDOS_ROOT}/dotfiles/fstab >>/etc/fstab chmod 766 ${SHARED_DIR} sed -i "s/password=/password=${GIBSON_PASS}/" /etc/gibson systemctl daemon-reload mkdir -p /home/guest/Desktop ln -s ${SHARED_DIR} /home/hacdc/Desktop/gibson ln -s ${SHARED_DIR} /home/guest/Desktop/gibson chown guest:guest /home/guest/Desktop/gibson chown hacdc:hacdc /home/hacdc/Desktop/gibson chmod 755 ${SHARED_DIR} fi # Set login wallpaper cp ${HDOS_ROOT}/dotfiles/htown.png /usr/share/backgrounds/htown.png chmod 755 /usr/share/backgrounds/htown.png # TODO: Change this to lightdm sed -i 's/^background=.*$/background=\/usr\/share\/backgrounds\/htown.png/' /usr/share/sddm/themes/*/theme.conf.user rm /usr/share/backgrounds/kali-16x9/default ln -s /usr/share/backgrounds/htown.png /usr/share/backgrounds/kali-16x9/default # Didn't change it for hacdc login # worked for guest mksquashfs /home/guest ${HDOS_ROOT}/guest.sqfs cp ${HDOS_ROOT}/scripts/restore-home /usr/sbin/restore-home cp ${HDOS_ROOT}/dotfiles/guest-restore.service /etc/systemd/system/guest-restore.service systemctl daemon-reload systemctl enable guest-restore.service systemctl enable ssh reboot