This commit is contained in:
firebadnofire 2024-05-01 19:37:38 -04:00
parent 0b5907ee4f
commit 488f5714a1
Signed by: firebadnofire
SSH Key Fingerprint: SHA256:bnN1TGRauJN84CxL1IZ/2uHNvJualwYkFjOKaaOilJE
4 changed files with 233 additions and 88 deletions

View File

@ -1,3 +1,5 @@
# zsh-deploy
Bash script for deploying my zsh configs and zsh to a new machine
`curl -sL https://archuser.org/zsh.sh | bash`

120
fastfetch.sh Normal file
View File

@ -0,0 +1,120 @@
#!/bin/bash
# This script is to install fastfetch since it isn't in many repos by default
# In the rare case someone decides to curl this and pipe it to bash, this script has been wrapped in a main function and executes it at the bottom
# This is done to prevent code running before it is meant to or in an incomplete manner
# It doesn't even work right when curled to bash anyway
main() {
# Detecting the distribution
if [ -f /etc/os-release ]; then
source /etc/os-release
case $ID in
ubuntu)
choice=1
;;
debian)
if [ "$(uname -m)" == "aarch64" ]; then
choice=3
else
choice=2
fi
;;
archarm)
choice=4
;;
arch)
choice=4
;;
fedora|rhel)
choice=5
;;
gentoo)
choice=6
;;
alpine)
choice=7
;;
nixos)
choice=8
;;
opensuse*)
choice=9
;;
alt)
choice=10
;;
*)
echo "Unsupported distribution. Exiting..."
exit 1
;;
esac
else
echo "OS release file (/etc/os-release) not found. Exiting..."
exit 1
fi
# Use a case statement to handle the results
case $choice in
1)
echo "Installing for Ubuntu"
sudo add-apt-repository ppa:zhangsongcui3371/fastfetch
sudo apt update
sudo apt install -y fastfetch
;;
2)
echo "Installing for Debian x86-64"
curl -sLo ~/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb
sudo dpkg -i ~/fastfetch.deb
rm ~/fastfetch.deb
;;
3)
echo "Installing for Debian ARM64"
curl -sLo ~/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-aarch64.deb
sudo dpkg -i ~/fastfetch.deb
rm ~/fastfetch.deb
;;
4)
echo "Installing for Arch"
sudo pacman -S fastfetch
;;
5)
echo "Installing for Fedora/RHEL"
sudo dnf install fastfetch
;;
6)
echo "Installing for Gentoo"
sudo emerge --ask app-misc/fastfetch
;;
7)
echo "Installing for Alpine"
apk add --upgrade fastfetch
;;
8)
echo "Installing for NixOS"
nix-shell -p fastfetch
;;
9)
echo "Installing for OpenSUSE"
sudo zypper install fastfetch
;;
10)
echo "Installing for ALT Linux"
sudo apt-get install fastfetch
;;
e|E)
echo "Exiting..."
cd ~
break
;;
*)
echo "Invalid selection. Please choose a number from 1 to 10, or 'e' to exit."
;;
esac
}
# Execute the main function
main

View File

@ -1,4 +1,15 @@
#!/bin/bash
# This script is actually meant to be fetched by curl and piped to bash therefore, this script has been wrapped in a main function and executes it at the bottom
# This is done to prevent code running before it is meant to or in an incomplete manner
main() {
curl -s -o /tmp/zsh.sh -L https://codeberg.org/firebadnofire/zsh-deploy/raw/branch/main/zsh.sh
curl -s -o /tmp/zsh.sh -L https://codeberg.org/firebadnofire/zsh-deploy/raw/branch/main/fastfetch.sh
clear
chmod +x /tmp/zsh.sh
echo "run /tmp/zsh.sh"
}
# Execute the main function
main

20
zsh.sh
View File

@ -1,7 +1,12 @@
#!/bin/bash
MAINPKGS="aria2 zip curl zsh git unzip neofetch sudo"
MAINPKGSF="$MAINPKGS fzy"
# In the rare case someone decides to curl this and pipe it to bash, this script has been wrapped in a main function and executes it at the bottom
# This is done to prevent code running before it is meant to or in an incomplete manner
# It doesn't even work right when curled to bash anyway
main() {
MAINPKGSD="aria2 zip curl zsh git unzip sudo lsb_release"
MAINPKGSF="aria2 zip curl zsh git unzip sudo fzy lsb-release"
while true; do
# Display the menu
echo "Menu:"
@ -11,6 +16,7 @@ while true; do
echo "4. Raspberry Pi"
echo "5. Install Rust"
echo "6. Install Zshrc"
echo "7. Install fastfetch"
echo "e. Exit"
# Prompt the user for input
@ -41,7 +47,7 @@ while true; do
3)
echo "You chose RHEL"
echo "installing packages"
sudo dnf install -y "$MAINPACKS https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.5/repo/oss/x86_64/fzy-0.9-bp155.2.10.x86_64.rpm epel-release"
sudo dnf install -y "$MAINPKGSD https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.5/repo/oss/x86_64/fzy-0.9-bp155.2.10.x86_64.rpm epel-release"
;;
4)
echo "You chose Raspberry Pi"
@ -76,7 +82,9 @@ while true; do
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/tom-auger/cmdtime
;;
7)
/tmp/fastfetch.sh
;;
e|E)
echo "Exiting..."
cd ~
@ -87,3 +95,7 @@ while true; do
;;
esac
done
}
# Execute the main function
main