Files
general-scripts-and-system-…/customscripts/debian-setup.sh
T
2026-05-22 23:21:17 -06:00

78 lines
2.2 KiB
Bash

#!/bin/bash
set -euo pipefall
# to give pass/fail output from da commmands
## usage like checkcode $?
checkcode () {
if [ -z "$1" ]; then
echo -e "\n\e[31mERROR!\033[0m chkcode missing return code paramater\n"
exit 1
else
retcode=$1
fi
if [ $retcode -ne 0 ]; then
echo -e "\t\e[31mERROR!\033[0m Response Code: $retcode"
else
echo -e "\t\e[1;32mOK!\e[0m"
fi
}
echo "apt: START"
echo "apt: updating"
sudo apt update &> /dev/null
checkcode $?
echo "apt: running dist-upgrade"
sudo apt dist-upgrade -y &> /dev/null
checkcode $?
echo "apt: install packages"
sudo apt install -y gawk curl wget git gh build-essential scrypt openssl argon2 qbittorrent xfce4 apache2 php php-cli php-bz2 php-crypt-gpg php-curl php-date php-db php-decimal php-doc php-email-validator php-enum php-facedetect &> /dev/null
checkcode $?
echo "apt: autoremoving"
sudo apt autoremove -y &> /dev/null
checkcode $?
echo "apt: FINISHED"
echo "pyenv: START"
echo "pyenv: installin"
curl -fsSL https://pyenv.run | bash &> /dev/null
checkcode $?
echo "pyenv: adding exports to ~/.bashrc"
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
checkcode $?
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
checkcode $?
echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc
checkcode $?
echo "pyenv: sourcing to ~/.bashrc"
source ~/.bashrc
checkcode $?
echo "pyenv: installing latest python3"
pyenv install 3:latest &> /dev/null
checkcode $?
echo "pyenv: setting latest python3 as global"
pyenv global 3:latest &> /dev/null
checkcode $?
echo "pyenv: FINISHED"
echo "ble.sh: START"
echo "ble.sh: changing directory to /tmp"
cd /tmp
checkcode $?
echo "ble.sh: downloading"
git clone --recursive --depth 1 --shallow-submodules --single-branch -b master https://github.com/akinomyoga/ble.sh.git &> /dev/null
checkcode $?
echo "ble.sh: building and installing"
make -C ble.sh install PREFIX=~/.local &> /dev/null
checkcode $?
echo "ble.sh: setting up ~/.bashrc file"
echo '# ble.sh' >> ~/.bashrc
checkcode $?
echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc
checkcode $?
echo 'ble.sh: sourcing ~/.bashrc'
checkcode $?
source ~/.bashrc
checkcode $?
echo "ble.sh: FINISH"