Skip to content

Instantly share code, notes, and snippets.

@apolzek
Created October 19, 2024 11:22
Post install EndeavourOS i3wm Desktop
#!/bin/bash
sudo -v
###################################
# Updating repositories
# Installin Timeshift
# Creating a system snapshot
#################################
notify-send "Script Start" "Updating repositories..."
# Update repositories
sudo pacman -Syu --noconfirm
notify-send "Update Complete" "Repositories have been updated."
notify-send "Installing Timeshift" "Installing Timeshift..."
# Install Timeshift
sudo pacman -S --noconfirm timeshift
notify-send "Installation Complete" "Timeshift has been successfully installed."
# Get the current date
DATE=$(date +"%Y-%m-%d")
notify-send "Creating Snapshot" "Creating a system snapshot..."
# Create a snapshot with the description "EndeavourOS from scratch <date>"
sudo timeshift --create --comments "EndeavourOS from scratch $(date +'%Y-%m-%d %H:%M:%S')" --tags D
notify-send "Snapshot Created" "Snapshot successfully created!"
sleep 10
######################################################################################################
# Install packages
######################################################################################################
# List of packages to install
PACKAGES=(
visual-studio-code-bin
google-chrome
anki
obsidian
cheese-git
discord
arduino-ide-bin
balena-etcher
lens
dbeaver
neovim-git
zoom
tor-browser-bin
obs-studio-git
qbittorrent-git
)
notify-send "Package Installation" "Starting package installation..."
# Loop through each package and install individually
for PACKAGE in "${PACKAGES[@]}"; do
yay -S --noconfirm "$PACKAGE"
if [ $? -eq 0 ]; then
notify-send "Installation Complete" "$PACKAGE has been successfully installed!"
else
notify-send "Installation Error" "An error occurred while installing $PACKAGE."
fi
done
notify-send "Package Listing" "Checking installed packages..."
# List installed packages
for PACKAGE in "${PACKAGES[@]}"; do
if pacman -Qs "$PACKAGE" > /dev/null; then
echo "$PACKAGE: installed"
else
echo "$PACKAGE: not installed"
fi
done
exit
###################################################
# Create the directory /opt/setup if it doesn't exist
sudo mkdir -p /opt/setup
# Notify about the download start
notify-send "Downloading Go" "Downloading Go version 1.23.2..."
# Download the Go package to /opt/setup
wget -q -P /opt/setup https://go.dev/dl/go1.23.2.linux-amd64.tar.gz
# Notify about the extraction process
notify-send "Extracting Go" "Extracting Go files..."
# Remove any existing Go installation and extract the downloaded Go package
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf /opt/setup/go1.23.2.linux-amd64.tar.gz
# Notify about successful installation
notify-send "Go Installation" "Go has been successfully installed."
###################################################
#!/bin/bash
BASHRC="/home/apolzek/.bashrc"
# Function to add or update content in .bashrc
add_bashrc_content() {
local marker="$1"
local content="$2"
# Check if the marker exists
if grep -q "$marker" "$BASHRC"; then
# Remove lines below the marker
awk "/$marker/{exit} {print}" "$BASHRC" > "${BASHRC}.tmp"
# Append the new content
{
cat "${BASHRC}.tmp"
echo "$content"
} > "$BASHRC"
# Remove temporary file
rm "${BASHRC}.tmp"
notify-send "Update Complete" "The .bashrc file has been successfully updated!"
else
# Append the marker and content if not found
{
echo "$marker"
echo "$content"
} >> "$BASHRC"
notify-send "Marker Added" "The marker '$marker' and new content were added to .bashrc."
fi
}
# Backup the original .bashrc
notify-send "Backing Up .bashrc" "Creating a backup of .bashrc..."
cp "$BASHRC" "${BASHRC}.bak"
# Define the combined content to be added to .bashrc
combined_content="
# by: apolzek
alias lsa='ls -la'
export PATH=\$PATH:/usr/local/go/bin:/home/apolzek/.local/bin:/home/apolzek/go/bin:/home/apolzek/.pulumi/bin
. \"\$HOME/.cargo/env\"
alias docker_killall='docker rm -f \$(docker ps -aq)'
# Monitor aliases
alias MONITOR_ALL='xrandr --output HDMI-1 --mode 1920x1080 --primary --left-of eDP-1 --output eDP-1 --auto'
alias MONITOR_ALL_ABOVE='xrandr --output HDMI-1 --mode 1920x1080 --primary --above eDP-1 --output eDP-1 --auto'
alias MONITOR_JUST_HDMI='xrandr --output HDMI-1 --mode 1920x1080 --primary --output eDP-1 --off'
alias MONITOR_JUST_NOTEBOOK='xrandr --output HDMI-1 --off --output eDP-1 --auto'
alias KEYBOARD_LOCAL='setxkbmap -model thinkpad -layout br -variant abnt2'
alias MONITOR_NOTEBOOK_BRILHANTE='xrandr --output eDP-1 --brightness 1.2'
alias clip='xclip -selection clipboard'
# pnpm configuration
export PNPM_HOME=\"/home/apolzek/.local/share/pnpm\"
case \":\$PATH:\" in
*\":\$PNPM_HOME:\"*) ;;
*) export PATH=\"\$PNPM_HOME:\$PATH\" ;;
esac
# pnpm end
alias CD_OBSIDIAN='cd ~/.Obsidian/apolzek'
alias WIFIPASS='echo # cat /etc/NetworkManager/system-connections/*'
# asdf configuration
. \"\$HOME/.asdf/asdf.sh\"
. \"\$HOME/.asdf/completions/asdf.bash\"
# Add Pulumi to the PATH
export PATH=\$PATH:/home/apolzek/.pulumi/bin
eval \"\$(~/.local/bin/mise activate bash)\"
. /home/apolzek/.nix-profile/etc/profile.d/nix.sh
"
# Add the combined content under one marker
add_bashrc_content "# by: apolzek" "$combined_content"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment