99 lines
2.9 KiB
Bash
Executable File
99 lines
2.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
function update-os {
|
|
# Updating
|
|
sudo apt-get update -y
|
|
sudo apt-get upgrade -y
|
|
}
|
|
|
|
function remove-bad-package {
|
|
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
|
|
sudo apt autoremove -y
|
|
}
|
|
|
|
function instsall-core-package {
|
|
sudo apt install -y \
|
|
git \
|
|
jq \
|
|
nfs-common
|
|
sh <(curl -L https://nixos.org/nix/install) --daemon
|
|
}
|
|
|
|
function install-docker {
|
|
echo "Add Docker's official GPG key..."
|
|
sudo apt-get install ca-certificates curl gnupg
|
|
sudo install -m 0755 -d /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
|
|
|
echo "Set up Docker's APT repository..."
|
|
echo \
|
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian \
|
|
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
sudo apt-get update -y
|
|
|
|
echo "Install docker..."
|
|
sudo apt-get install -y \
|
|
docker-ce \
|
|
docker-ce-cli \
|
|
containerd.io \
|
|
docker-buildx-plugin \
|
|
docker-compose-plugin
|
|
}
|
|
|
|
function install-docker-compose-systemd {
|
|
sudo mkdir -p /etc/docker/compose/
|
|
sudo cp systemd/docker-compose@.service /etc/systemd/system/docker-compose@.service
|
|
}
|
|
|
|
function mount-nfs-torrents {
|
|
sudo cp /etc/fstab /etc/fstab.backup
|
|
sudo mkdir -p /torrents
|
|
sudo echo "truenas.local:/mnt/EightTerra/DownloadedTorrents /torrents/ nfs auto 0 0" | sudo tee -a /etc/fstab
|
|
sudo mount -a
|
|
}
|
|
|
|
function install-qbittorrent {
|
|
sudo useradd -r -m qbittorrent
|
|
sudo usermod -a -G qbittorrent $USER
|
|
sudo apt install -y qbittorrent-nox
|
|
sudo cp systemd/qbittorrent.service /etc/systemd/system/qbittorrent.service
|
|
sudo systemctl start qbittorrent
|
|
sudo systemctl enable qbittorrent
|
|
}
|
|
|
|
function install-speedtest-cli {
|
|
mkdir -p $HOME/.local/bin
|
|
mkdir -p $HOME/tmp/speedtest
|
|
pushd $HOME/tmp/speedtest/
|
|
wget https://github.com/librespeed/speedtest-cli/releases/download/v1.0.10/librespeed-cli_1.0.10_linux_armv7.tar.gz
|
|
tar -xvf librespeed-cli_1.0.10_linux_armv7.tar.gz
|
|
cp librespeed-cli $HOME/.local/bin/speedtest-cli
|
|
popd
|
|
rm -rf $HOME/tmp/speedtest
|
|
}
|
|
|
|
|
|
function install-transmission {
|
|
sudo apt-get install transmission-daemon
|
|
sudo ufw allow 9091,51413/tcp
|
|
}
|
|
|
|
function set-static-ip() {
|
|
ip=${1}
|
|
intf=${2:-eth0}
|
|
routerip=${3:-192.168.8.1}
|
|
echo "
|
|
# <---- AUTOGENERATED --->
|
|
interface $intf
|
|
static_routers=$routerip
|
|
static ip_address=$ip/24
|
|
# <---- AUTOGENERATED --->
|
|
" | tee -a /etc/dhcpcd.conf
|
|
}
|
|
|
|
function install-openvpn {
|
|
sudo apt install openvpn
|
|
sudo cp systemd/openvpn.service /etc/systemd/system/openvpn-client.service
|
|
} |