|
| 1 | +#!/bin/bash |
| 2 | +#root portion of the setup customization |
| 3 | +set -e |
| 4 | +if [[ $EUID -ne 0 ]]; then |
| 5 | + echo "You must be root to do this." 1>&2 |
| 6 | + exit 100 |
| 7 | +fi |
| 8 | + |
| 9 | +### SET HOSTNAME ### |
| 10 | +HOST_NAME=$(cat /etc/hostname) |
| 11 | +if [ $HOST_NAME == *"alarm"* ]; then |
| 12 | +echo "Skyminer node setup" |
| 13 | +echo "Setting hostname, please enter a unique identifier for this node" |
| 14 | +read -p "A number between 1 and 8 is recommended: " -r |
| 15 | +HOST_NAME=${REPLY} |
| 16 | +echo "visor$HOST_NAME" > /etc/hostname |
| 17 | +#else |
| 18 | +#echo "$HOST_NAME" > /etc/hostname |
| 19 | +#fi |
| 20 | +fi |
| 21 | + |
| 22 | +if [ ! -z $1 ]; then |
| 23 | +AURLOCAL=${1} |
| 24 | +fi |
| 25 | + |
| 26 | +if [ -z $AURLOCAL ]; then |
| 27 | + set -e |
| 28 | +#prompt to enter sky manager IP address |
| 29 | +read -p "Please input IP address of the hypervisor: " -r |
| 30 | +AURLOCAL=${REPLY} |
| 31 | +fi |
| 32 | + |
| 33 | +# backup the mirrorlist |
| 34 | +if [ ! -f /etc/pacman.d/mirrorlist-bak ]; then |
| 35 | + cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist-bak |
| 36 | +fi |
| 37 | + |
| 38 | +#set the AURLOCAL IP as a mirror for pacman to retrieve updates from |
| 39 | +echo "$(echo "Server = http://$AURLOCAL:8079" | cat - /etc/pacman.d/mirrorlist-bak)" > /root/mirrorlist |
| 40 | +mv /root/mirrorlist /etc/pacman.d/mirrorlist |
| 41 | + |
| 42 | +#backup pacman.conf |
| 43 | +if [ ! -f /etc/pacman.conf-bak ]; then |
| 44 | + cp /etc/pacman.conf /etc/pacman.conf-bak |
| 45 | +fi |
| 46 | + |
| 47 | +#add the skyminer repo to pacman.conf |
| 48 | +cat /etc/pacman.conf-bak > /root/pacman.conf |
| 49 | +echo -e " |
| 50 | +[aur-local] |
| 51 | +SigLevel = PackageOptional |
| 52 | +Server = http://$AURLOCAL:8079 |
| 53 | +" >> /root/pacman.conf |
| 54 | +mv /root/pacman.conf /etc/pacman.conf |
| 55 | + |
| 56 | + |
| 57 | +### BOOTSTRAPPING ### |
| 58 | +#boilerplate archlinux setup |
| 59 | +pacman-key --init |
| 60 | +pacman-key --populate |
| 61 | + |
| 62 | +#sync the repos |
| 63 | +pacman -Syy |
| 64 | + |
| 65 | +#update the keyring first to avoid errors from missing keys |
| 66 | +pacman -S archlinux-keyring --noconfirm |
| 67 | + |
| 68 | +#install skywire-mainnet from the skyminer repo on the manager |
| 69 | +yes | pacman -S skywire --noconfirm |
| 70 | + |
| 71 | +#install macchanger, create and enable a systemd service or MAC address will be 36:c9:e3:f1:b8:05 |
| 72 | +pacman -S macchanger --noconfirm |
| 73 | + |
| 74 | +systemctl enable macchanger.service |
| 75 | + |
| 76 | +#full system update |
| 77 | +yes | pacman -Syu --noconfirm |
| 78 | + |
| 79 | +#reboot for stablity because the kernel was probably updated |
| 80 | +reboot now |
0 commit comments