diff --git a/README.md b/README.md new file mode 100644 index 0000000..dc5be04 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +FRESH SCRIPT +------------ + +Install script for my Arch Linux based workstations. +Heavily inspired by [LARBS](https://github.com/LukeSmithxyz/LARBS). + +To get started, run the following code after booting into the installation medium +``` bash +curl https://g.phga.de/toerd/fresh/raw/branch/master/bootstrap.sh | bash +``` + +Done! diff --git a/bootstrap.sh b/bootstrap.sh index 3ca45e4..dfdec5d 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -9,25 +9,33 @@ do case $opt in esac done +init() { + [ -z "$NAME" ] && read -p "Hostname: " NAME + [ -z "$PASSWD" ] && while [ "$PASSWD" = "$CHECK"]; do + && read -sp "Root password: " PASSWD && read -sp "Repeat: " CHECK && + done + # Show some possible disks + [ -z "$DEV" ] && lsblk -nrpo "name,size,model" && read -s "Provide installation medium (e.g. /dev/sda): " DEV + [[ "$DEV" =~ "sd[a-z]" ]] && SUF="1-3" && MODE="SATA" + [[ "$DEV" =~ "nvme[0-9]n[0-9]" ]] && SUF="p1-3" && MODE="NVME" + + echo "+---------------------+" + echo "| Archlinux Bootstrap |" + echo "+---------------------+" + echo "HOSTNAME = $NAME" + echo "ROOTPASSWD = $PASSWD" + echo "DEVICEPARTS = $DEV$SUF" + read -s "Do you want to continue with these values (y/n): " cont + [ ! "$cont" = "y" ] && unset NAME PASSWD DEV && init +} + # stop on error set -e +# initialize important values +init -PASSWD=${PASSWD:="toor"} -NAME=${NAME:="archibald"} -DEV=${DEV:="nvme0n1"} - - -echo "+---------------------+" -echo "| Archlinux Bootstrap |" -echo "+---------------------+" -echo "ROOTPASSWD = $PASSWD" -echo "HOSTNAME = $NAME" -echo -e "DEVICE = $DEV\n" -sleep 2 - -timedatectl set-ntp true - +# All values set, start bootstrapping gdisk < see good2know -pacstrap /mnt base base-devel linux linux-firmware vi dhcpcd wpa_supplicant dialog git netctl +pacstrap /mnt base base-devel linux linux-firmware vi dhcpcd wpa_supplicant dialog git netctl curl genfstab -p /mnt > /mnt/etc/fstab cat < /mnt/root/bootstrap2.sh #!/bin/bash - ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime -hwclock --systohc -utc echo "en_US.UTF-8 UTF-8" > /etc/locale.gen locale-gen @@ -84,7 +98,7 @@ mkinitcpio -p linux pacman -Sy --noconfirm efibootmgr dosfstools gptfdisk bootctl install - +# MAYBE: add intel-ucode images, check for amd cat < /boot/loader/entries/arch-uefi.conf title Arch linux /vmlinuz-linux @@ -110,6 +124,10 @@ reflector --country 'Germany' --sort rate --protocol https --save /etc/pacman.d/ printf "${PASSWD}\n${PASSWD}\n" | passwd root +cd && curl -L https://g.phga.de/toerd/fresh/archive/master.tar.gz -o fresh.tar.gz && tar -xzf fresh.tar.gz +# basically a shitty one time job +echo '/root/fresh/fresh.sh' > .bashrc + exit EOF diff --git a/fresh.sh b/fresh.sh index b78e7c9..b8946e4 100755 --- a/fresh.sh +++ b/fresh.sh @@ -233,6 +233,34 @@ set_system_stuff() { # sudo -u $uname /home/$uname/.dotfiles/syncthing/link-confs.sh &>> $logfile echo "Leave system stuff\n\n" >> $logfile } + +set_root_bashrc() { + cat < /root/.bashrc +# Fix for tramp connections +[ $TERM = "dumb" ] && return + +set -o vi + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTCONTROL=ignoreboth:erasedups HISTSIZE=100000 HISTFILESIZE=200000 +PROMPT_COMMAND='history -a' + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +alias ls='ls --color=auto --group-directories-first' +alias grep='grep --color=auto' +alias ll='ls -alSFhv' +[ -f /etc/bash_completion ] && ! shopt -oq posix && . /etc/bash_completion + +# PS1 config +export PS1="\[$(tput bold)\]\[\033[38;5;1m\]ROOT\[$(tput sgr0)\]@\w\n->\[$(tput sgr0)\]" +EOF +} # ACTUAL ROUTINE case $todo in @@ -250,6 +278,7 @@ case $todo in set_system_stuff # enable_service "--user syncthing" "netctl-auto@wlp3s0" "--user offlineimap@philip_thi" "--user offlineimap@philip_posteo" "--user offlineimap@philip_gmail" enable_service "netctl-auto@wlp3s0" "systemd-timesyncd" + set_root_bashrc ready_steady_go clear ;;