Files
dotfiles/apt-install.sh

171 lines
6.8 KiB
Bash
Executable File

#!/bin/sh
# This script expects an OS that is based on Debian in at least package management
usage="$(basename "$0") [-h] [-s] [-d] [-n hostname] -- my script for initializing apt repos on new Linux installs
\n\n
where:\n
-h, ? \t\t\tshow this help text\n
-d, --distro \tDistro name, default bookworm
-s, --server \t\tonly install server components\n
-n, --name [hostname] \tset the hostname to the argument"
# A repos don't support virginia (Mint codename), only recognizing Jammy (Ubuntu)
distro=bookworm
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
client=true
if [ $(id -u) -ne 0 ]
then echo "$(id -un), you're gonna have a real bad time trying to do this as a regular user.\n\nSudo it up." | fold -w 80 -s
exit 0
fi
# Some POSIX getopts goodness for portability
while getopts "h?d-s-n-:v-" opt; do
case "$opt" in
h|\?)
echo -e $usage | fold -w 80 -s
exit 0
;;
d|distro) distro=$OPTARG
;;
s|server) client=false
;;
n|name)
hostnamectl set-hostname $OPTARG
;;
v|version)
echo "Versioning? On this?"
exit 0
;;
-)
case "${OPTARG}" in
version)
echo "Versioning? On this?"
;;
distro)
distro=$OPTARG
;;
name)
hostnamectl set-hostname $OPTARG
;;
esac
;;
esac
done
# A few repos need the i386 arch
dpkg --add-architecture i386
# Some packages need these
apt install -y wget gnupg lsb-release apt-transport-https ca-certificates software-properties-common
# A few packages store their keys in specific location that doesn't exist at first
install -m 0755 -d /etc/apt/keyrings
if [ $client ]; then
# Brave Browser - for everything that doesn't run in Firefox
apt -y install curl
curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
# Signal Desktop Client
wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg
cat signal-desktop-keyring.gpg | tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' |\
tee /etc/apt/sources.list.d/signal-xenial.list
# Mullvad
rm -f /etc/apt/sources.list.d/mullvad.list
curl -fsSLo /usr/share/keyrings/mullvad-keyring.asc https://repository.mullvad.net/deb/mullvad-keyring.asc
echo "deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=$( dpkg --print-architecture )] https://repository.mullvad.net/deb/stable $distro main" | sudo tee /etc/apt/sources.list.d/mullvad.list
# VS Codium
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
| gpg --dearmor \
| dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' \
| tee /etc/apt/sources.list.d/vscodium.list
# Wine
wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources
# Nicotine for Soulseek
#add-apt-repository ppa:nicotine-team/stable
# Solaar - Logitech management software
#add-apt-repository ppa:solaar-unifying/stable
# AppImage Launcher
#add-apt-repository ppa:appimagelauncher-team/stable
AILTAG=$(curl -ILs https://github.com/TheAssassin/AppImageLauncher/releases/latest -w %{url_effective} -o /dev/null | awk -F "/" '{print $NF}')
AILDEB=$(curl -s https://github.com/TheAssassin/AppImageLauncher/releases | grep amd64.deb | head -n 1 | cut -d '/' -f 7 | cut -d '"' -f 1)
AILURL="https://github.com/TheAssassin/AppImageLauncher/releases/download/$AILTAG/$AILDEB"
curl -fSLo /home/matt/dotfiles/$AILDEB $AILURL
# Virtual Box
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $distro contrib" | tee /etc/apt/sources.list.d/vitualbox.list
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
# Librewolf
apt install -y wget gnupg lsb-release apt-transport-https ca-certificates
rm -f /usr/share/keyrings/librewolf.gpg
wget -O- https://deb.librewolf.net/keyring.gpg | gpg --dearmor -o /usr/share/keyrings/librewolf.gpg
cat <<EOF> /etc/apt/sources.list.d/librewolf.sources
Types: deb
URIs: https://deb.librewolf.net
Suites: $distro
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/librewolf.gpg
EOF
fi
if [ !client ]
then
# Docker
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$distro stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
fi
# Stuff everybody gets
# Fastfetch. R.I.P. Neofetch
FFTAG=$(curl -ILs https://github.com/fastfetch-cli/fastfetch/releases/latest -w %{url_effective} -o /dev/null | awk -F "/" '{print $NF}')
FFDEB=$(curl -s https://github.com/fastfetch-cli/fastfetch/releases/ | grep amd64.deb | head -n 1 | cut -d '/' -f 2)
FFURL="https://github.com/fastfetch-cli/fastfetch/releases/download/$FFTAG/$FFDEB"
curl -fSLo /home/matt/dotfiles/$FFDEB $FFURL
# Update or none of this will show up
apt update
if [ $client ]
then
# Apps that don't need anything besides the parent package call
apt install -y brave-browser signal-desktop mullvad-vpn codium librewolf solaar
apt install -y /home/matt/dotfiles/$AILDEB
rm /home/matt/dotfiles/$AILDEB
# Wine has some recommends, install that with its own command
apt install -y --install-recommends winehq-stable
else
# Docker just has a lot
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
fi
apt install -y/home/matt/dotfiles/$AILDEB
rm /home/matt/dotfiles/$AILDEB
apt install -y putty-tools sshfs htop iftop
apt install -y /home/matt/dotfiles/$FFDEB
rm /home/matt/dotfiles/$FFDEB
apt autoremove -y