update set-up-system.sh
This commit is contained in:
+54
-17
@@ -2,12 +2,21 @@
|
|||||||
set -e
|
set -e
|
||||||
sudo -v
|
sudo -v
|
||||||
|
|
||||||
function banner_top() {
|
# the horrors
|
||||||
echo -e "────┤ $1 ├────\n"
|
function banner() {
|
||||||
}
|
local pos=$1
|
||||||
|
local w=50
|
||||||
|
local text=" $2 "
|
||||||
|
local pad=$((w - ${#text}))
|
||||||
|
local l=$((pad/2)) r=$((pad - pad/2))
|
||||||
|
local left=$(printf '%*s' "$l" ''); left=${left// /─}
|
||||||
|
local right=$(printf '%*s' "$r" ''); right=${right// /─}
|
||||||
|
|
||||||
function banner_bottom() {
|
if [[ "$pos" == "top" ]]; then
|
||||||
echo -e "\n────┤ $1 ├────\n\n\n"
|
printf "┌%s%s%s┐\n\n" "$left" "$text" "$right"
|
||||||
|
else
|
||||||
|
printf "\n└%s%s%s┘\n\n" "$left" "$text" "$right"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# https://patorjk.com/software/taag/#p=display&f=Small+Slant
|
# https://patorjk.com/software/taag/#p=display&f=Small+Slant
|
||||||
@@ -19,49 +28,77 @@ cat << 'EOF'
|
|||||||
/___//___/
|
/___//___/
|
||||||
..... brought to you by futile
|
..... brought to you by futile
|
||||||
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# check if on fedora
|
# check if on fedora
|
||||||
if ! grep -q '^ID=fedora$' /etc/os-release 2>/dev/null; then
|
if ! grep -q '^ID=fedora$' /etc/os-release 2>/dev/null; then
|
||||||
banner_top "errrm... why aren't you on fedora"
|
echo "errrm... why aren't you on fedora"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# get preferences
|
||||||
|
banner top "getting preferences"
|
||||||
|
while [[ -z "$hostname" ]]; do
|
||||||
|
read -rp "choose hostname: " hostname
|
||||||
|
done
|
||||||
|
while [[ -z "$pubkey" ]]; do
|
||||||
|
read -rp "give ssh key: " pubkey
|
||||||
|
done
|
||||||
|
echo -e "using hostname \"$hostname\""
|
||||||
|
banner bottom "got preferences"
|
||||||
|
|
||||||
|
# write ssh key
|
||||||
|
banner top "writing ssh key"
|
||||||
|
sudo mkdir -p ~/.ssh
|
||||||
|
sudo chmod 700 ~/.ssh
|
||||||
|
sudo touch ~/.ssh/authorized_keys
|
||||||
|
sudo chmod 600 ~/.ssh/authorized_keys
|
||||||
|
sudo chown -R admin ~/.ssh
|
||||||
|
echo "$pubkey" >> ~/.ssh/authorized_keys
|
||||||
|
banner bottom "wrote ssh key"
|
||||||
|
|
||||||
|
# change hostname
|
||||||
|
banner top "changing hostname"
|
||||||
|
sudo hostnamectl hostname $hostname
|
||||||
|
sudo hostnamectl
|
||||||
|
banner bottom "changed hostname"
|
||||||
|
|
||||||
# configure dnf
|
# configure dnf
|
||||||
banner_top "configuring dnf"
|
banner top "configuring dnf"
|
||||||
sudo tee /etc/dnf/dnf.conf << 'EOF'
|
sudo tee /etc/dnf/dnf.conf << 'EOF'
|
||||||
[main]
|
[main]
|
||||||
defaultyes = True
|
defaultyes = True
|
||||||
max_parallel_downloads = 10
|
max_parallel_downloads = 10
|
||||||
EOF
|
EOF
|
||||||
banner_bottom "configured dnf"
|
banner bottom "configured dnf"
|
||||||
|
|
||||||
# update system
|
# update system
|
||||||
banner_top "updating system"
|
banner top "updating system"
|
||||||
sudo dnf update -y
|
sudo dnf update -y
|
||||||
banner_bottom "updated system"
|
banner bottom "updated system"
|
||||||
|
|
||||||
# install (& configure) docker
|
# install (& configure) docker
|
||||||
banner_top "installing docker"
|
banner top "installing docker"
|
||||||
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo --overwrite
|
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo --overwrite
|
||||||
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
sudo usermod -aG docker $(id -un)
|
sudo usermod -aG docker $(id -un)
|
||||||
sudo systemctl enable --now docker
|
sudo systemctl enable --now docker
|
||||||
sudo docker run hello-world
|
sudo docker run hello-world
|
||||||
banner_bottom "installed docker"
|
banner bottom "installed docker"
|
||||||
|
|
||||||
# install (& configure) fish
|
# install (& configure) fish
|
||||||
banner_top "installing fish"
|
banner top "installing fish"
|
||||||
sudo dnf install -y fish
|
sudo dnf install -y fish
|
||||||
sudo chsh -s $(which fish) $(id -un)
|
sudo chsh -s $(which fish) $(id -un)
|
||||||
fish -c "set -U fish_greeting"
|
fish -c "set -U fish_greeting"
|
||||||
fish -c "set -Ux EDITOR $(which micro)"
|
fish -c "set -Ux EDITOR $(which micro)"
|
||||||
banner_bottom "installed fish"
|
banner bottom "installed fish"
|
||||||
|
|
||||||
# install misc
|
# install misc
|
||||||
banner_top "installing other packages"
|
banner top "installing other packages"
|
||||||
sudo dnf install -y micro btop fastfetch
|
sudo dnf install -y micro btop fastfetch
|
||||||
banner_bottom "installed other packages"
|
banner bottom "installed other packages"
|
||||||
|
|
||||||
# finish
|
# finish
|
||||||
banner_top "done! please log out and log back in"
|
echo -e "done! please log out and log back in\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user