diff options
| -rw-r--r-- | TODO.org | 1 | ||||
| -rwxr-xr-x | init | 106 | ||||
| -rw-r--r-- | wipedisk | 30 |
3 files changed, 55 insertions, 82 deletions
@@ -18,6 +18,7 @@ chmod +x /tmp/script.sh Now the user can curl and pipe this small script =curl -s https://url-to-the-above-script | sh=. Please ensure the path where you store the script (=/tmp/script.sh= in this scenario) is safe and suitable for your users. This will take care of downloading the script, making it executable, and running it, which should allow prompts for user input to function as expected. + * ArchSetup v0.5 ** Add Rofi application launcher and game launcher ** Add some games @@ -10,86 +10,28 @@ # the workstation occur in other scripts, called by this script. # Run as root after booting the live cd and issuing the following command: -# curl -s https://cjennings.net/archsetup/init | bash -i - -welcome () { - clear - echo "" - echo "ArchSetup" - echo "---------" - echo "" - echo "" -} - -check_root_or_exit () { - if [ "$EUID" -ne 0 ] - then echo "Please run as root" - exit - fi -} - -setup_ssh () { - # retrieve keys from repo and decrypt - echo "retrieving keys for decryption..." - { - mkdir -p "$HOME/.ssh/" - # retrieve keys from dotfiles repo and decrypt the keys - (git clone --depth 1 https://git.cjennings.net/dotfiles.git \ - "$HOME/dotfiles/") >> /dev/null - cp "$HOME/dotfiles/system/.ssh/*" "$HOME/.ssh/" - rm -rf "$HOME/dotfiles/" - } > /dev/null - cd "$HOME/.ssh/" - gpg --decrypt "$HOME/ssh.tar.gz.gpg" | tar -zxf - - - # set proper permissions on .ssh directory - cd "$HOME" && chmod 600 $HOME/.ssh/* && chmod 700 $HOME/.ssh \ - && chmod 644 $HOME/.ssh/*.pub - - # setup ssh - echo "setting up ssh daemon..." - systemctl start sshd - echo "root:welcome" | chpasswd - hostname=$(</etc/hostname) - ipaddress=$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) - - # notify user - echo ""; echo "" - echo "you may ssh root@$hostname or ssh root@$ipaddress using the password 'welcome'" +# curl -s https://cjennings.net/archsetup/init | bash -i + +## +## CHECK ROOT +## +if [ "$EUID" -ne 0 ] +then echo "Must run as root" + exit +fi + + + +## +## SSH +## +echo "setting up ssh daemon..." +systemctl start sshd +echo "root:welcome" | chpasswd +hostname=$(</etc/hostname) +ipaddress=$(ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) + +# notify user +echo ""; echo "" +echo "you may ssh root@$hostname or ssh root@$ipaddress using the password 'welcome'" } - -############ SCRIPT - -check_root_or_exit - -# present menu -echo "Choose:" -echo " (1) create an arch linux base install" -echo " (2) turn a base install into a full workstation" -echo " (3) generate a workstation in an arch distrobox container" -echo " (4) allow ssh to this live iso" -echo " (Enter 1, 2, 3, or 4) :" - -IFS= read -r setup -# read setup - -echo "You chose '$SETUP'." - -case $setup in - 1) - echo "this will call the archinstall script" - ;; - 2) - echo "this will call the archsetup script" - ;; - 3) - echo "this will call the archsetup-distrobox script" - ;; - 4) - setup_ssh - ;; - *) - echo "Error: Unknown setup option. Please enter 1,2,3,or 4." - exit 1 - ;; -esac diff --git a/wipedisk b/wipedisk new file mode 100644 index 0000000..0c08c72 --- /dev/null +++ b/wipedisk @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Craig Jennings <c@cjennings.net> +# identify disk and erase + +all_disk_ids=( $(ls /dev/disk/by-id/) ) +echo ""; echo "Select the disk id to use. All data will be erased." +select disk_id in "${all_disk_ids[@]}"; do + # ensure valid selection + if [[ -n $disk_id ]]; then + selection=$disk_id + break + else + echo "Invalid. Try again." + fi +done + +# Confirm the selected disk +read -p "Confirm: '$selection' [y/n]? " choice +if [[ "$choice" != "y" ]]; then + echo "Exiting..." + exit 1 +fi + +DISK="/dev/disk/by-id/$selection" +echo ""; echo "### Erasing Disk" +blkdiscard -f "${DISK}" || true # discard all sectors on flash-based storage +sgdisk --zap-all "${DISK}" # clear the disk + +echo "" +echo "Disk erased."
\ No newline at end of file |
