generic-install/generic_install.sh

791 lines
28 KiB
Bash
Raw Permalink Normal View History

2024-07-20 17:01:22 +00:00
## curl -L -o generic_install.sh https://nurl.co/5v
NVM="$HOME/.nvm"
NVM_VERSION="v0.39.7"
NODE_VERSION="--lts=iron"
DEV="$HOME/dev"
LIVE="$HOME/live"
STAGING="$HOME/staging"
SWAP="/swapfile"
WORK_DIR=$(mktemp -d)
MERCURY_BUILD="123.0.1"
MERCURY_CPU="AVX2"
THORIUM_BUILD="124.0.6367.218"
THORIUM_CPU="AVX2"
KOPIA_BUILD="0.17.0"
GOLAND_BUILD="2024.1.4"
WEBSTORM_BUILD="2024.1.5"
IDEAIC_BUILD="2024.1.4"
GOLANG_BUILD="1.22.4"
FERDIUM_BUILD="6.7.5"
NERDFONTS_VERSION="v3.0.2"
FLUTTER_BUILD="3.22.2"
LAPCE_BUILD="0.4.0"
NERDFONTS_URL="https://github.com/ryanoasis/nerd-fonts/releases/download/$NERDFONTS_VERSION/"
PKG_MANAGER=$(command -v yum || command -v apt-get) || echo "Neither yum nor apt-get found"
SNAP_MANAGER=$(command -v snap) || echo "No Snap Manager"
FLATPAK_MANAGER=$(command -v flatpak) || echo "No Flatpack Manager"
PKG_DEVICE=$(basename "$PKG_MANAGER")
SNAP_DEVICE=$(basename "$SNAP_MANAGER")
FLATPAK_DEVICE=$(basename "$FLATPAK_MANAGER")
pidof systemd && SYSTEMDCALL=1 || SYSTEMDCALL=0
DISTRO=$(cat /etc/*-release | grep -w ID | cut -d= -f2 | tr -d '"' | grep -w debian)
CODENAME=$(lsb_release --codename --short)
ISSUE=$(cat /etc/issue)
OSSYSTEM=0
if echo "$ISSUE" | grep -q "MX"; then
OSSYSTEM=1
echo "Working on MXLINUX"
fi
DATABASE=no
NGINX=no
FONTADDRESS="https://cloud.caliban.io/index.php/s/FeLWYZCamZyptwC/download/fonts.zip"
CURSORADDRESS="https://cloud.caliban.io/index.php/s/R5iC99T6qLiicJG/download/128152-AmigaClassicRed.zip"
RED=$(tput setaf 1)
GREEN=$(tput setaf 10)
YELLOW=$(tput setaf 11)
PURPLE=$(tput setaf 13)
RESET=$(tput sgr0)
NC='\033[0m'
BLACK='\033[1;30m'
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
PURPLE='\033[1;35m'
CYAN='\e[1;96m'
WHITE='\033[1;37m'
RESET='\033[0m'
fancy_echo() {
local fmt="$1"
shift
printf "\n$fmt\n" "$@"
}
add_line() {
FILE=$1
LINE=$2
grep -qF "$LINE" "$FILE" || echo "$LINE" | sudo -S tee --append "$FILE"
}
function checkSUDO() {
if [[ $sudoPW == "" ]]; then
read -s -p "Enter Password for sudo: " sudoPW
fi
}
fetch() {
fhost=$(uname -n)
fuser=$(whoami)
fkernel=$(uname -r)
fupTime=$(uptime --pretty | sed -e 's/up//;s/^ *//')
fos=$(awk -F '"' '/PRETTY/ {print $2}' /etc/os-release | tr -d '\n')
farch=$(uname -m)
fcpu=$(awk -F: '/model name/{print $2 ; exit}' /proc/cpuinfo | sed 's/\<Processor\>//g;s/^ *//' | tr -d '\n')
fgpu=$(lspci | grep -i --color 'vga\|3d\|2d' | sed 's/VGA compatible controller//;s/Advanced Micro Devices, Inc//;s/NVIDIA Corporation//' | tr -d '.:[]' | sed 's/^.....//;s/^ *//')
fram=$(awk '/MemTotal:/ {printf "%d MiB\n", $2 / 1024}' /proc/meminfo | tr -d '\n')
shell="$(echo "$SHELL" | sed 's%.*/%%')"
term="$(pstree -sA $$)"
term="$(echo "${term%---$shell*}")"
term="$(echo ${term##*---})"
echo -ne "\e[3m$PURPLE$fuser$NC\e[0m"
echo -e "\e[3m@$YELLOW$fhost$NC\e[0m"
echo -e "${BLUE}kernel$NC ~ $fkernel"
echo -e "${CYAN}uptime$NC ~ $fupTime"
echo -ne "${GREEN}os$NC ~ $fos"
echo -ne " \e \e \e \e "
echo -e "${PURPLE}arch$NC ~ $farch"
if test -e /usr/share/xsessions/; then
echo -ne "${YELLOW}de/wm$NC ~ "
awk '/^DesktopNames/' /usr/share/xsessions/* | sed 's/DesktopNames=//g' | sed 's/\;/\n/g' | sed '/^$/d' | sort -u | sed ':a;N;$!ba;s/\n/, /g' | tr -d "\n"
fi
if test -e ~/.config/gtk-3.0/; then
echo -ne " \e \e \e \e "
echo -ne "${BLUE}theme$NC ~ "
grep 'gtk-theme-name' ~/.config/gtk-3.0/* | sed 's/gtk-theme-name=//g' | sed 's/-/ /g'
fi
echo -ne "${RED}cpu$NC ~ $fcpu"
if test -e /sys/devices/system/cpu; then
sort -rn /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq | head -n1 | sed 's/......$/.&/;s/...$//;s/^/@/' | tr -d '\n'
echo " GHz"
fi
echo -e "${PURPLE}gpu$NC ~ $fgpu"
echo -ne "${BLUE}pkgs$NC ~ "
if [[ $(command -v pacman) ]]; then
pacman -Q | wc -l
elif [[ $(command -v dpkg-query) ]]; then
dpkg-query -l | grep -c '^.i'
else
echo not found
fi
echo -ne "${CYAN}ram$NC ~ $fram"
swap_kb=$(awk '{print $3}' /proc/swaps | sed '1d')
let "swap_mb = $swap_kb / 1024"
if test -e /proc/swaps; then
echo -ne " \e \e \e \e "
echo -ne "${YELLOW}swap$NC ~ "
echo $swap_mb MiB
fi
echo -ne "${GREEN}term$NC ~ "
echo "$term" | tr -d "\n"
echo -ne " \e \e \e \e "
echo -ne "${RED}shell$NC ~ "
echo "$shell"
}
if [[ ! $WORK_DIR || ! -d $WORK_DIR ]]; then
echo "Could not create temp dir"
exit 1
else
cd "$WORK_DIR"
fi
function cleanup() {
rm -rf "$WORK_DIR"
fancy_echo "${YELLOW}Deleted temp working directory $WORK_DIR$RESET"
}
function updateApt() {
echo $sudoPW | sudo -S apt-get -y -q --assume-yes update
}
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | jq -r .tag_name
}
function installLazyDocker() {
fancy_echo "${YELLOW}Installing LazyDocker...$RESET"
DIR="${DIR:-"$HOME/.local/bin"}"
ARCH=$(uname -m)
case $ARCH in
i386 | i686) ARCH=x86 ;;
armv6*) ARCH=armv6 ;;
armv7*) ARCH=armv7 ;;
aarch64*) ARCH=arm64 ;;
esac
GITHUB_LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' https://github.com/jesseduffield/lazydocker/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
GITHUB_FILE="lazydocker_${GITHUB_LATEST_VERSION//v/}_$(uname -s)_$ARCH.tar.gz"
GITHUB_URL="https://github.com/jesseduffield/lazydocker/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
curl -L -o lazydocker.tar.gz $GITHUB_URL
tar xzvf lazydocker.tar.gz lazydocker
install -Dm 755 lazydocker -t "$DIR"
rm lazydocker lazydocker.tar.gz
}
function show_latest() {
echo "Mercury:$(get_latest_release Alex313031/Mercury)"
echo "Thorium:$(get_latest_release Alex313031/thorium)"
echo "Ferdium:$(get_latest_release ferdium/ferdium-app)"
echo "Nvm:$(get_latest_release nvm-sh/nvm)"
echo "Kopia:$(get_latest_release kopia/kopia)"
}
function installMercury() {
if [ $OSSYSTEM -eq 1 ]; then
checkSUDO
echo -e "${CYAN}Installing Mercury...$NC"
curl -L -o mercury-browser.deb "https://github.com/Alex313031/Mercury/releases/download/v.$MERCURY_BUILD/mercury-browser_${MERCURY_BUILD}_$MERCURY_CPU.deb"
echo $sudoPW | sudo -S apt install ./mercury-browser.deb --assume-yes
fi
}
function installThorium() {
if [ $OSSYSTEM -eq 1 ]; then
checkSUDO
echo -e "${CYAN}Installing Thorium...$NC"
curl -L -o thorium-browser.deb "https://github.com/Alex313031/thorium/releases/download/M$THORIUM_BUILD/thorium-browser_${THORIUM_BUILD}_$THORIUM_CPU.deb"
echo $sudoPW | sudo -S apt install ./thorium-browser.deb --assume-yes
export CHROME_EXECUTABLE=/usr/bin/thorium-browser
LINE='CHROME_EXECUTABLE=/usr/bin/thorium-browser'
FILE="$HOME/.exports"
grep -qF "$LINE" "$FILE" || echo "$LINE" | tee --append "$FILE"
fi
}
function installFerdium() {
if [ $OSSYSTEM -eq 1 ]; then
checkSUDO
echo -e "\n${CYAN}Installing Ferdium...$NC"
curl -L -o ferdium.deb "https://github.com/ferdium/ferdium-app/releases/download/v$FERDIUM_BUILD/Ferdium-linux-$FERDIUM_BUILD-amd64.deb"
echo $sudoPW | sudo -S apt install ./ferdium.deb --assume-yes
fi
}
function installLapce() {
if [ $OSSYSTEM -eq 1 ]; then
checkSUDO
echo -e "\n${CYAN}Installing Lapce...$NC"
curl -L -o lapce.deb "https://github.com/lapce/lapce/releases/download/v$LAPCE_BUILD/lapce.debian.bookworm.amd64.deb"
echo $sudoPW | sudo -S apt install ./lapce.deb --assume-yes
fi
}
function download_fonts() {
curl -s https://api.github.com/repos/ryanoasis/nerd-fonts/releases | jq -r '.[0].assets[] | select(.browser_download_url | endswith(".zip")) | .browser_download_url' | parallel --bar -t -- curl -sLOC - {}
}
function download_install_script() {
rm -f install.sh
curl -OL https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/install.sh
chmod +x install.sh
}
function remove_old_stuff() {
rm -rf "$HOME/patched-fonts" && mkdir -p "$HOME/patched-fonts"
}
function installNerdFonts() {
fancy_echo "${YELLOW}Installing NerdFonts...$RESET"
download_fonts
download_install_script
ls -1b | parallel -- unzip -o {} \*.\[ot\]tf -d "$HOME/.fonts/{.}"
}
function getDotFiles() {
fancy_echo "${YELLOW}Installing Dot files...$RESET"
DOTALIAS="https://cloud.caliban.io/index.php/s/MLgwngKGApKzJA2/download/_aliases"
DOTBASHPROMPT="https://cloud.caliban.io/index.php/s/kyC3GLmkt8aM5x2/download/_bash_prompt"
DOTEXPORTS="https://cloud.caliban.io/index.php/s/69tNTcFrGMH2GqN/download/_exports"
DOTFUNCTIONS="https://cloud.caliban.io/index.php/s/rtSR3ZR77EXQWZG/download/_functions"
DOTGITCONFIG="https://cloud.caliban.io/index.php/s/rtE3wD2reakww3b/download/_gitconfig"
DOTGITIGNORE="https://cloud.caliban.io/index.php/s/Qj6F7x8WossYtYN/download/_gitignore"
DOTPATH="https://cloud.caliban.io/index.php/s/M6mdGg4QRDpzD6d/download/_path"
PROFILEIMPORTER="https://cloud.caliban.io/index.php/s/cNFiaeEsZ8R58TW/download/profile_importer.sh"
curl -L -o "$HOME/.aliases" $DOTALIAS
curl -L -o "$HOME/.bash_prompt" $DOTBASHPROMPT
curl -L -o "$HOME/.exports" $DOTEXPORTS
curl -L -o "$HOME/.functions" $DOTFUNCTIONS
curl -L -o "$HOME/.gitconfig" $DOTGITCONFIG
curl -L -o "$HOME/.gitignore" $DOTGITIGNORE
curl -L -o "$HOME/.path" $DOTPATH
curl -L -o "$HOME/profile_importer.sh" $PROFILEIMPORTER
chmod u+x "$HOME/profile_importer.sh"
LINE='source "$HOME/profile_importer.sh"'
FILE="$HOME/.bashrc"
grep -qF "$LINE" "$FILE" || echo "$LINE" | tee --append "$FILE"
}
function installFlutter() {
fancy_echo "${YELLOW}Installing Flutter...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt --assume-yes install curl git unzip xz-utils zip libglu1-mesa
echo $sudoPW | sudo -S apt --assume-yes install libc6:amd64 libstdc++6:amd64 libbz2-1.0:amd64 libncurses5:amd64
echo $sudoPW | sudo -S apt --assume-yes install clang cmake pkg-config libgtk-3-dev
curl -L -o flutter_linux.tar.xz "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_$FLUTTER_BUILD-stable.tar.xz"
echo $sudoPW | sudo -S mkdir -p /usr/bin/
echo $sudoPW | sudo -S tar -xf ./flutter_linux.tar.xz -C /usr/bin/
LINE='PATH=/usr/bin/flutter/bin:$PATH'
FILE="$HOME/.path"
grep -qF "$LINE" "$FILE" || echo "$LINE" | tee --append "$FILE"
}
function installGO() {
fancy_echo "${PURPLE}Installing Go...$RESET"
checkSUDO
curl -L -o go.tar.gz "https://go.dev/dl/go$GOLANG_BUILD.linux-amd64.tar.gz"
echo $sudoPW | sudo -S rm -rf /usr/local/go
echo $sudoPW | sudo -S tar -C /usr/local -xzf ./go.tar.gz
}
function installIcons() {
fancy_echo "${PURPLE}Installing Icons...$RESET"
checkSUDO
wget -qO- https://git.io/papirus-icon-theme-install | DESTDIR="/usr/share/icons/" sh
}
function setupHomeDirs() {
if [ ! -d "$DEV" ]; then
mkdir -p $DEV
fi
if [ ! -d "$LIVE" ]; then
mkdir -p $LIVE
fi
if [ ! -d "$STAGING" ]; then
rm -rf $STAGING
mkdir -p $STAGING
else
mkdir -p $STAGING
fi
}
function doUpdates() {
fancy_echo "${PURPLE}Updating system packages$RESET"
checkSUDO
if [ $(basename $PKG_MANAGER) = "yum" ]; then
echo $sudoPW | sudo -S yum --assumeyes upgrade
echo $sudoPW | sudo -S yum --assumeyes install deltarpm psmisc
echo $sudoPW | sudo -S yum --assumeyes install git make automake gcc gcc-c++ kernel-devel nginx htop screen wget curl pi-bluetooth
else
echo $sudoPW | sudo -S apt-get -y -q --assume-yes update
echo $sudoPW | sudo -S apt-get -y -q --assume-yes upgrade
echo $sudoPW | sudo -S apt-get -y -q --assume-yes clean
echo $sudoPW | sudo -S apt autoremove --assume-yes
echo $sudoPW | sudo -S apt autoclean --assume-yes
fi
if [[ $SNAP_DEVICE == "snap" ]]; then
fancy_echo "${PURPLE}Updating Snaps$RESET"
echo $sudoPW | sudo -S snap refresh
fi
if [[ $FLATPAK_DEVICE == 'flatpak' ]]; then
fancy_echo "${PURPLE}Updating Flatpak$RESET"
flatpak update -y
flatpak uninstall --unused -y
fi
}
function installServer() {
fancy_echo "${YELLOW}Installing Base Server ...$RESET"
checkSUDO
setupHomeDirs
echo $sudoPW | sudo -S apt --assume-yes install auto-apt-proxy
sleep 5
echo $sudoPW | sudo -S apt --assume-yes install build-essential screen wget curl htop git
echo $sudoPW | sudo -S apt --assume-yes install cifs-utils
echo $sudoPW | sudo -S apt --assume-yes install software-properties-common
if [ $DISTRO = "debian" ]; then
echo $sudoPW | sudo -S add-apt-repository --yes "deb [arch=$(dpkg --print-architecture)] http://ftp.debian.org/$DISTRO $( lsb_release --codename --short)-backports main"
sleep 5
echo $sudoPW | sudo -S apt --assume-yes install btop
fi
if [ $OSSYSTEM -eq 0 ]; then
echo $sudoPW | sudo -S apt --assume-yes install ubuntu-restricted-addons flatpak git htop
fi
echo $sudoPW | sudo -S apt -y -q --assume-yes clean
echo $sudoPW | sudo -S apt autoremove --assume-yes
echo $sudoPW | sudo -S apt autoclean --assume-yes
if [ $OSSYSTEM -eq 0 ]; then
echo $sudoPW | sudo -S flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
if [[ ! -f "$HOME/opt" ]]; then
mkdir $HOME/opt
fi
if [[ ! -f "$HOME/.aliases" ]]; then
getDotFiles
fi
}
function instalExternalServer() {
fancy_echo "${YELLOW}Installing Base Server ...$RESET"
checkSUDO
setupHomeDirs
echo $sudoPW | sudo -S apt --assume-yes install build-essential screen wget curl htop git
echo $sudoPW | sudo -S apt --assume-yes install software-properties-common
if [ $DISTRO = "debian" ]; then
echo $sudoPW | sudo -S add-apt-repository --yes "deb [arch=$(dpkg --print-architecture)] http://ftp.debian.org/$DISTRO $( lsb_release --codename --short)-backports main"
sleep 5
echo $sudoPW | sudo -S apt --assume-yes install btop
fi
if [ $OSSYSTEM -eq 0 ]; then
echo $sudoPW | sudo -S apt --assume-yes install ubuntu-restricted-addons flatpak git htop
fi
echo $sudoPW | sudo -S apt -y -q --assume-yes clean
echo $sudoPW | sudo -S apt autoremove --assume-yes
echo $sudoPW | sudo -S apt autoclean --assume-yes
if [[ ! -f "$HOME/opt" ]]; then
mkdir $HOME/opt
fi
if [[ ! -f "$HOME/.aliases" ]]; then
getDotFiles
fi
}
function installFail2Ban() {
fancy_echo "${YELLOW}Installing Fail2Ban ...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt --assume-yes install fail2ban
echo $sudoPW | sudo -S cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local
echo $sudoPW | sudo -S cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
echo $sudoPW | sudo -S systemctl enable fail2ban.service
}
function installUnattendedUpgrades() {
fancy_echo "${YELLOW}Installing Unattended Upgrades ...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt install unattended-upgrades
echo $sudoPW | sudo -S systemctl enable unattended-upgrades
echo $sudoPW | sudo -S systemctl start unattended-upgrades
}
function installUFW() {
fancy_echo "${YELLOW}Installing UFW ...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt --assume-yes install ufw
echo $sudoPW | sudo -S ufw default allow outgoing
echo $sudoPW | sudo -S ufw default deny incoming
echo $sudoPW | sudo -S ufw allow ssh
echo $sudoPW | sudo -S ufw allow http
echo $sudoPW | sudo -S ufw allow https
echo $sudoPW | sudo -S ufw allow from 81.187.43.39
echo $sudoPW | sudo -S ufw enable
echo $sudoPW | sudo -S ufw status
}
function installRequired() {
fancy_echo "${YELLOW}Installing Required ...$RESET"
checkSUDO
setupHomeDirs
echo $sudoPW | sudo -S apt --assume-yes install auto-apt-proxy
sleep 5
echo $sudoPW | sudo -S apt --assume-yes install build-essential nginx screen wget curl default-jdk trimage pandoc texlive
echo $sudoPW | sudo -S apt --assume-yes install redshift-gtk cifs-utils gnome-disk-utility
echo $sudoPW | sudo -S apt --assume-yes install software-properties-common ca-certificates gnupg parallel jq
if [ $DISTRO = "debian" ]; then
echo $sudoPW | sudo -S add-apt-repository --yes "deb [arch=$(dpkg --print-architecture)] http://ftp.debian.org/$DISTRO $( lsb_release --codename --short)-backports main"
sleep 5
echo $sudoPW | sudo -S apt-get -y -q --assume-yes update
echo $sudoPW | sudo -S apt --assume-yes install btop
fi
if [ $OSSYSTEM -eq 0 ]; then
echo $sudoPW | sudo -S apt --assume-yes install ubuntu-restricted-addons flatpak git htop
fi
echo $sudoPW | sudo -S apt -y -q --assume-yes clean
echo $sudoPW | sudo -S apt autoremove --assume-yes
echo $sudoPW | sudo -S apt autoclean --assume-yes
if [ $OSSYSTEM -eq 0 ]; then
echo $sudoPW | sudo -S flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
if [[ ! -f "$HOME/opt" ]]; then
mkdir $HOME/opt
fi
if [[ ! -f "$HOME/.aliases" ]]; then
getDotFiles
fi
if [[ ! $FLATPAK_DEVICE == 'flatpak' ]]; then
FLATPAK_MANAGER=$(command -v flatpak) || echo "No Flatpack Manager"
FLATPAK_DEVICE=$(basename $FLATPAK_MANAGER)
fi
}
function setupSwap() {
if [[ ! -f $SWAP ]]; then
fancy_echo "${YELLOW}Setting up swapfile...$RESET"
checkSUDO
echo $sudoPW | sudo -S fallocate -l 1G $SWAP
echo $sudoPW | sudo -S chmod 600 $SWAP
echo $sudoPW | sudo -S mkswap $SWAP
echo $sudoPW | sudo -S swapon $SWAP
add /swapfile/swapfile none swap defaults 0 0 to /etc/fstab
fi
}
function installNode() {
fancy_echo "${YELLOW}Installing Node...$RESET"
checkSUDO
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash
export NVM_DIR=$NVM
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
source $HOME/.bashrc
source $NVM/nvm.sh
nvm install $NODE_VERSION
fancy_echo "${YELLOW}Installing Node Global Packages...$RESET"
npm install -g gulp npm-check npm-install-missing
npm install -g @angular/cli @vue/cli eslint prettier @ionic/cli
# pm2 update
}
function installAmd() {
fancy_echo "${YELLOW}Installing AMD...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt-add-repository -r ppa:graphics-drivers/ppa --yes && sudo -S apt update --assume-yes && sudo -S apt upgrade --assume-yes && sudo -S apt autoremove --assume-yes && sudo -S apt autoclean --assume-yes
echo $sudoPW | sudo -S add-apt-repository ppa:oibaf/graphics-drivers --yes --enable-source
echo $sudoPW | sudo -S apt-get update --assume-yes
echo $sudoPW | sudo -S apt upgrade --assume-yes
echo $sudoPW | sudo -S dpkg --configure -a
echo $sudoPW | sudo -S dpkg-reconfigure lightdm
echo $sudoPW | sudo -S apt-get install mesa-vdpau-drivers
}
function removeAmd() {
fancy_echo "${RED}Removing AMD...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt-get install aptitude ppa-purge --assume-yes
echo $sudoPW | sudo -S ppa-purge ppa:oibaf/graphics-drivers
echo $sudoPW | sudo -S apt update --assume-yes
echo $sudoPW | sudo -S apt upgrade --assume-yes
}
function installApps() {
fancy_echo "${YELLOW}Installing APPS...$RESET"
checkSUDO
if [[ $SNAP_DEVICE == 'snap' ]]; then
fancy_echo "${PURPLE}Installing SNAPS...$RESET"
fi
echo $sudoPW | sudo -S apt --assume-yes install autokey-gtk
if [ $OSSYSTEM -eq 0 ]; then
curl -L -o google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
echo $sudoPW | sudo -S apt install ./google-chrome-stable_current_amd64.deb
echo $sudoPW | sudo -S add-apt-repository --yes ppa:nextcloud-devs/client
echo $sudoPW | sudo -S apt-get update --assume-yes
echo $sudoPW | sudo -S apt-get install nextcloud-client --assume-yes
fi
if [ $OSSYSTEM -eq 1 ]; then
installMercury
installThorium
installFerdium
curl -L -o kopia-ui.deb "https://github.com/kopia/kopia/releases/download/v$KOPIA_BUILD/kopia-ui_${KOPIA_BUILD}_amd64.deb"
curl -L -o google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
curl -L -o goodhosts.tar.gz https://github.com/goodhosts/cli/releases/download/v1.1.2/goodhosts-1.1.2-linux-amd64.tar.gz
echo $sudoPW | sudo -S apt-get install nextcloud-desktop --assume-yes
echo $sudoPW | sudo -S apt install ./kopia-ui.deb --assume-yes
fi
if [[ $FLATPAK_DEVICE == 'flatpak' ]]; then
fancy_echo "${PURPLE}Installing FLATPAKS...$RESET"
echo $sudoPW | sudo -S flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub org.qownnotes.QOwnNotes -y
flatpak install flathub com.orama_interactive.Pixelorama -y
flatpak install flathub eu.scarpetta.PDFMixTool -y
flatpak install flathub no.mifi.losslesscut -y
flatpak install flathub org.freac.freac -y
flatpak install flathub org.kde.digikam -y
flatpak install flathub com.bitwarden.desktop -y
flatpak install flathub io.gitlab.Goodvibes -y
flatpak install flathub org.atheme.audacious -y
flatpak install flathub org.gnome.Evolution -y
flatpak install flathub org.videolan.VLC -y
flatpak install flathub org.zealdocs.Zeal -y
flatpak install flathub org.gnome.EasyTAG -y
flatpak install flathub org.gnome.Firmware -y
flatpak install flathub com.github.gijsgoudzwaard.image-optimizer -y
flatpak install flathub org.gnome.baobab -y
flatpak install flathub org.gnome.DejaDup -y
flatpak install flathub com.github.qarmin.czkawka -y
fi
}
function installDocker() {
fancy_echo "${PURPLE}Installing DOCKER For $DISTRO...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt-get remove --yes --assume-yes docker docker.io containerd runc || true
echo $sudoPW | sudo -S apt-get remove --yes --assume-yes docker-engine || true
echo $sudoPW | sudo -S apt-get update --assume-yes
echo $sudoPW | sudo -S apt-get --yes --assume-yes --no-install-recommends install apt-transport-https ca-certificates cgroupfs-mount
echo $sudoPW | sudo -S apt-key adv --fetch-keys "https://download.docker.com/linux/$DISTRO/gpg"
echo $sudoPW | sudo -S add-apt-repository --yes "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$DISTRO $( lsb_release --codename --short) stable"
sleep 2
echo $sudoPW | sudo -S apt-get update
echo $sudoPW | sudo -S apt-get --yes --assume-yes --no-install-recommends install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo $sudoPW | sudo -S usermod --append --groups docker "$USER"
echo $sudoPW | sudo -S systemctl enable docker
echo $sudoPW | sudo -S systemctl enable docker.service
echo $sudoPW | sudo -S systemctl enable containerd.service
fancy_echo "${PURPLE}Docker installed successfully$RESET"
fancy_echo "${YELLOW}Waiting for Docker to start...$RESET"
sleep 5
echo $sudoPW | sudo -S curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
echo $sudoPW | sudo -S chmod +x /usr/local/bin/docker-compose
echo $sudoPW | sudo -S curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
installLazyDocker
fancy_echo "${PURPLE}Docker Compose installed successfully$RESET"
}
function installFonts() {
fancy_echo "${YELLOW}Installing Fonts...$RESET"
wget $FONTADDRESS -O $WORK_DIR/fonts.zip
if [[ ! -f "$HOME/.fonts" ]]; then
mkdir -p $HOME/.fonts
fi
unzip -o $WORK_DIR/fonts.zip -d $HOME/.fonts
echo $sudoPW | sudo -S fc-cache -vf
}
function installLaptop() {
fancy_echo "${YELLOW}Installing Laptop...$RESET"
checkSUDO
echo $sudoPW | sudo -S apt --assume-yes install tlp tlp-rdw
echo $sudoPW | sudo -S systemctl enable tlp
echo $sudoPW | sudo -S tlp start
}
function installMouse() {
fancy_echo "${YELLOW}Installing Mouse...$RESET"
wget $CURSORADDRESS -O $WORK_DIR/cursors.zip
if [[ ! -f "$HOME/.icons" ]]; then
mkdir $HOME/.icons
fi
unzip -o $WORK_DIR/cursors.zip -d $HOME/.icons
}
function installTheme() {
fancy_echo "${YELLOW}Installing Theme...$RESET"
checkSUDO
mkdir -p $HOME/.local/share/xfce4/terminal/colorschemes
wget https://cloud.caliban.io/index.php/s/SkjLjb62msiNp3m/download/colorschemes.zip
unzip -o ./colorschemes.zip -d $HOME/.local/share/xfce4/terminal/colorschemes/
installIcons
if [[ ! -f "$HOME/.themes" ]]; then
mkdir $HOME/.themes
fi
wget https://cloud.caliban.io/index.php/s/LYb8MFLHdYorRYX/download/Desert-Teal-Blue-XFCE-1.3.zip -O $WORK_DIR/Desert-Teal-Blue-XFCE-1.3.zip
unzip -o $WORK_DIR/Desert-Teal-Blue-XFCE-1.3.zip -d $HOME/.themes
wget https://cloud.caliban.io/index.php/s/ps5qqY9DHybLzoW/download/stilo-theme.zip
echo $sudoPW | sudo -S unzip -o -d /usr/share/themes ./stilo-theme.zip
}
function installDevTools() {
fancy_echo "${PURPLE}Installing Devtools...$RESET"
checkSUDO
curl -L -o goland.tar.gz "https://download.jetbrains.com/go/goland-$GOLAND_BUILD.tar.gz"
curl -L -o webstorm.tar.gz https://download.jetbrains.com/webstorm/WebStorm-$WEBSTORM_BUILD.tar.gz
curl -L -o ideaIC.tar.gz https://download.jetbrains.com/idea/ideaIC-$IDEAIC_BUILD.tar.gz
curl -L -o code.deb 'https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64'
curl -L -o dbeaver-ce_latest_amd64.deb https://dbeaver.io/files/dbeaver-ce_latest_amd64.deb
mkdir -p $HOME/opt/{goland,webstorm,ideaIC}
tar -xf ./goland.tar.gz -C $HOME/opt/goland
tar -xf ./webstorm.tar.gz -C $HOME/opt/webstorm
tar -xf ./ideaIC.tar.gz -C $HOME/opt/ideaIC
installLapce
echo $sudoPW | sudo -S apt install ./code.deb --assume-yes
echo $sudoPW | sudo -S apt install ./dbeaver-ce_latest_amd64.deb --assume-yes
}
function setupHosts() {
checkSUDO
if [ ! -f "/usr/bin/goodhosts" ]; then
fancy_echo "${PURPLE}Installing Goodhosts...$RESET"
curl -L -o goodhosts.tar.gz https://github.com/goodhosts/cli/releases/download/v1.1.2/goodhosts-1.1.2-linux-amd64.tar.gz
mkdir ./goodhosts-out
tar -xvf ./goodhosts.tar.gz -C ./goodhosts-out
echo $sudoPW | sudo -S cp ./goodhosts-out/goodhosts /usr/bin/
fi
LOCALS=(
"sonarr.lan"
"transmission.lan"
"torrent.lan"
"radarr.lan"
"nextpvr.lan"
"ombi.lan"
"books.lan"
"menu.lan"
"links.lan"
"photos.lan"
"jobs.lan")
echo $sudoPW | sudo -S goodhosts a "192.168.1.102" "diskstation"
echo $sudoPW | sudo -S goodhosts a "192.168.0.204" "deepstore.lan"
echo $sudoPW | sudo -S goodhosts a "192.168.1.222" "docker.lan"
for host in "${LOCALS[@]}"; do
echo $sudoPW | sudo -S goodhosts a "192.168.1.159" "$host"
done
}
trap cleanup EXIT
for i in "$@"; do
case $i in
-u | --update)
doUpdates
shift
;;
-d | --database)
DATABASE=YES
shift
;;
-n | --nginx)
NGINX=YES
shift
;;
-i | --install | --setup)
doUpdates
installRequired
installNode
shift
;;
--install-server)
doUpdates
installServer
installDocker
shift
;;
--install-external-server)
doUpdates
instalExternalServer
installUnattendedUpgrades
installUFW
installUnattendedUpgrades
installDocker
shift
;;
--full-install)
doUpdates
installRequired
installNode
installMouse
installFonts
installTheme
installApps
installDocker
setupHosts
shift
;;
--full-dev-install)
doUpdates
installRequired
installNode
installMouse
installFonts
installTheme
installApps
installDevTools
installDocker
setupHosts
shift
;;
--install-amd)
doUpdates
installAmd
shift
;;
--remove-amd)
doUpdates
removeAmd
shift
;;
--install-fonts)
installFonts
shift
;;
--install-theme)
installTheme
shift
;;
--install-laptop)
installLaptop
shift
;;
--install-mouse)
installMouse
shift
;;
--install-apps)
doUpdates
installApps
shift
;;
--install-docker)
installDocker
shift
;;
--install-dev-tools)
doUpdates
installDevTools
shift
;;
--show-latest)
show_latest
shift
;;
--fetch)
fetch
exit
shift
;;
--setup-hosts)
setupHosts
shift
;;
--install-mercury)
installMercury
;;
--install-flutter)
installFlutter
;;
--install-ferdium)
installFerdium
;;
--install-lapce)
installLapce
;;
--default)
DEFAULT=YES
shift
;;
*) ;;
esac
done