Update .local/bin/provision

This commit is contained in:
Brian Zalewski 2022-11-30 08:18:47 +00:00
parent 0acf81202a
commit dedcb84911

View file

@ -2,42 +2,39 @@
set -eo pipefail set -eo pipefail
### Qubes dom0 specific code at top ### Qubes dom0
# The VM name that will manage the Ansible provisioning (for Qubes dom0) if command -v qubesctl > /dev/null; then
ANSIBLE_PROVISION_VM="provision" # The VM name that will manage the Ansible provisioning (for Qubes dom0)
ANSIBLE_PROVISION_VM="provision"
# Ensure sys-whonix is configured (for Qubes dom0) # Ensure sys-whonix is configured (for Qubes dom0)
CONFIG_WIZARD_COUNT=0 CONFIG_WIZARD_COUNT=0
ENABLE_OBFSC='false' ENABLE_OBFSC='false'
function configureWizard() { function configureWizard() {
if xwininfo -root -tree | grep "Anon Connection Wizard"; then if xwininfo -root -tree | grep "Anon Connection Wizard"; then
WINDOW_ID="$(xwininfo -root -tree | grep "Anon Connection Wizard" | sed 's/^ *\([^ ]*\) .*/\1/')" WINDOW_ID="$(xwininfo -root -tree | grep "Anon Connection Wizard" | sed 's/^ *\([^ ]*\) .*/\1/')"
xdotool windowactivate "$WINDOW_ID" && sleep 1 && xdotool key 'Enter' && sleep 1 && xdotool key 'Tab Tab Enter' && sleep 24 && xdotool windowactivate "$WINDOW_ID" && sleep 1 && xdotool key 'Enter' && sleep 300 xdotool windowactivate "$WINDOW_ID" && sleep 1 && xdotool key 'Enter' && sleep 1 && xdotool key 'Tab Tab Enter' && sleep 24 && xdotool windowactivate "$WINDOW_ID" && sleep 1 && xdotool key 'Enter' && sleep 300
qvm-shutdown --wait sys-whonix qvm-shutdown --wait sys-whonix
sleep 3 sleep 3
qvm-start sys-whonix qvm-start sys-whonix
if xwininfo -root -tree | grep "systemcheck | Whonix" > /dev/null; then if xwininfo -root -tree | grep "systemcheck | Whonix" > /dev/null; then
WINDOW_ID_SYSCHECK="$(xwininfo -root -tree | grep "systemcheck | Whonix" | sed 's/^ *\([^ ]*\) .*/\1/')" WINDOW_ID_SYSCHECK="$(xwininfo -root -tree | grep "systemcheck | Whonix" | sed 's/^ *\([^ ]*\) .*/\1/')"
if xdotool windowactivate "$WINDOW_ID_SYS_CHECK"; then if xdotool windowactivate "$WINDOW_ID_SYS_CHECK"; then
sleep 1 sleep 1
xdotool key 'Enter' xdotool key 'Enter'
fi
fi
else
sleep 3
CONFIG_WIZARD_COUNT=$((CONFIG_WIZARD_COUNT + 1))
if [[ "$CONFIG_WIZARD_COUNT" == '4' ]]; then
echo "The sys-whonix anon-connection-wizard utility did not open."
else
echo "Checking for anon-connection-wizard again.."
configureWizard
fi fi
fi fi
else }
sleep 3
CONFIG_WIZARD_COUNT=$((CONFIG_WIZARD_COUNT + 1))
if [[ "$CONFIG_WIZARD_COUNT" == '4' ]]; then
echo "The sys-whonix anon-connection-wizard utility did not open."
else
echo "Checking for anon-connection-wizard again.."
configureWizard
fi
fi
}
### Update via system package manager and install Homebrew dependencies
if command -v qubesctl > /dev/null; then
# Qubes dom0
### Ensure dom0 is updated ### Ensure dom0 is updated
if [ ! -f /root/dom0-updated ]; then if [ ! -f /root/dom0-updated ]; then
@ -82,44 +79,48 @@ if command -v qubesctl > /dev/null; then
fi fi
qvm-run --pass-io "$ANSIBLE_PROVISION_VM" 'curl -sSL https://install.doctor/start > ~/start.sh && bash ~/start.sh' qvm-run --pass-io "$ANSIBLE_PROVISION_VM" 'curl -sSL https://install.doctor/start > ~/start.sh && bash ~/start.sh'
exit 0 exit 0
elif command -v apt-get > /dev/null; then fi
# Debian / Ubuntu
sudo apt-get update ### System package manager update / Homebrew dependencies
sudo apt-get install -y curl git if ! command -v curl > /dev/null || ! command -v git > /dev/null; then
elif command -v dnf > /dev/null; then if command -v apt-get > /dev/null; then
# Fedora # Debian / Ubuntu
sudo dnf install -y curl git sudo apt-get update
elif command -v yum > /dev/null; then sudo apt-get install -y curl git
# CentOS elif command -v dnf > /dev/null; then
sudo yum install -y curl git # Fedora
elif command -v pacman > /dev/null; then sudo dnf install -y curl git
# Archlinux elif command -v yum > /dev/null; then
sudo pacman update # CentOS
sudo pacman -Sy curl git sudo yum install -y curl git
elif command -v zypper > /dev/null; then elif command -v pacman > /dev/null; then
# OpenSUSE # Archlinux
sudo zypper install -y curl git nodejs sudo pacman update
elif command -v apk > /dev/null; then sudo pacman -Sy curl git
# Alpine elif command -v zypper > /dev/null; then
apk add curl git # OpenSUSE
elif [ -d /Applications ] && [ -d /Library ]; then sudo zypper install -y curl git nodejs
# macOS elif command -v apk > /dev/null; then
sudo xcode-select -p >/dev/null 2>&1 || xcode-select --install # Alpine
elif command -v nix-env > /dev/null; then apk add curl git
# NixOS elif [ -d /Applications ] && [ -d /Library ]; then
echo "TODO - Add support for NixOS" # macOS
elif [[ "$OSTYPE" == 'freebsd'* ]]; then sudo xcode-select -p >/dev/null 2>&1 || xcode-select --install
# FreeBSD elif command -v nix-env > /dev/null; then
echo "TODO - Add support for FreeBSD" # NixOS
elif command -v pkg > /dev/null; then echo "TODO - Add support for NixOS"
# Termux elif [[ "$OSTYPE" == 'freebsd'* ]]; then
echo "TODO - Add support for Termux" # FreeBSD
elif command -v xbps-install > /dev/null; then echo "TODO - Add support for FreeBSD"
# Void elif command -v pkg > /dev/null; then
echo "TODO - Add support for Void" # Termux
elif [[ "$OSTYPE" == 'cygwin' ]] || [[ "$OSTYPE" == 'msys' ]] || [[ "$OSTYPE" == 'win32' ]]; then echo "TODO - Add support for Termux"
# Windows elif command -v xbps-install > /dev/null; then
choco install -y curl git node # Void
elif [[ "$OSTYPE" == 'cygwin' ]] || [[ "$OSTYPE" == 'msys' ]] || [[ "$OSTYPE" == 'win32' ]]; then
# Windows
choco install -y curl git node
fi
fi fi
### Install Homebrew ### Install Homebrew