Skip to content

Instantly share code, notes, and snippets.

@RBFraphael
Last active December 12, 2024 12:14
Show Gist options
  • Save RBFraphael/1ffd0338ca6f792abbf55f7e3d37c8e8 to your computer and use it in GitHub Desktop.
Save RBFraphael/1ffd0338ca6f792abbf55f7e3d37c8e8 to your computer and use it in GitHub Desktop.
Post install script for Linux Mint 22 - User mode
#!/usr/bin/env bash
NGROK_AUTHTOKEN='<put your ngrok authtoken here>'
GIT_USER='<put your git username here>'
GIT_EMAIL='<put your git user email here>'
C_YELLOW=`tput setaf 220`
C_RESET=`tput init`
check_root_user() {
if [ "$(id -u)" -e 0 ]; then
echo 'This script is intended to be run as non-root users'
exit
fi
}
show_message() {
echo -e "${C_YELLOW}\n\
----------------------------------------------- \n\
## $1 \n\
----------------------------------------------- \n\
${C_RESET}"
}
install_nvm() {
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 20
nvm install 18
nvm install 16
nvm install 14
nvm install 12
}
download_extensions() {
wget https://cinnamon-spices.linuxmint.com/files/applets/[email protected] -O ~/.local/share/cinnamon/applets/[email protected]
unzip ~/.local/share/cinnamon/applets/[email protected] -d ~/.local/share/cinnamon/applets/
rm ~/.local/share/cinnamon/applets/[email protected]
mkdir -p ~/.themes
wget https://github.com/dracula/gtk/archive/refs/heads/master.zip -O ~/.themes/Dracula-Dark.zip
unzip ~/.themes/Dracula-Dark.zip -d ~/.themes
mv ~/.themes/gtk-master ~/.themes/Dracula-Dark
rm ~/.themes/Dracula-Dark.zip
wget https://github.com/dracula/gtk/archive/refs/heads/alt-style.zip -O ~/.themes/Dracula-alt-style-Dark.zip
unzip ~/.themes/Dracula-alt-style-Dark.zip -d ~/.themes
mv ~/.themes/gtk-alt-style ~/.themes/Dracula-alt-style-Dark
rm ~/.themes/Dracula-alt-style-Dark.zip
}
set_dconf_settings() {
gsettings set org.cinnamon.theme name "Dracula-alt-style-Dark"
gsettings set org.cinnamon.desktop.interface gtk-theme "Dracula-alt-style-Dark"
gsettings set org.cinnamon.desktop.interface icon-theme "Papirus-Dark"
gsettings set org.cinnamon.desktop.wm.preferences button-layout "close,minimize,maximize:"
gsettings set org.cinnamon.desktop.wm.preferences theme "Dracula-alt-style-Dark"
gsettings set org.cinnamon.desktop.wm.preferences mouse-button-modifier ""
gsettings set org.cinnamon panels-enabled "['1:0:top', '2:0:bottom']"
gsettings set org.cinnamon panels-height "['1:28', '2:40']"
gsettings set org.cinnamon panel-zone-icon-sizes "[{\"panelId\": 1, \"left\": 16, \"center\": 16, \"right\": 16}, {\"left\": 16, \"center\": 24, \"right\": 16, \"panelId\": 2}]"
gsettings set org.cinnamon panel-zone-symbolic-icon-sizes "[{\"panelId\": 1, \"left\": 16, \"center\": 16, \"right\": 16}, {\"left\": 16, \"center\": 24, \"right\": 16, \"panelId\": 2}]"
gsettings set org.cinnamon panel-zone-text-sizes "[{\"panelId\":1,\"left\":0,\"center\":0,\"right\":0},{\"left\":0,\"center\":0,\"right\":0,\"panelId\":2}]"
gsettings set org.cinnamon enabled-applets "['panel2:center:0:[email protected]:0', 'panel2:center:1:[email protected]:2', 'panel1:right:2:[email protected]:3', 'panel1:right:3:[email protected]:4', 'panel1:right:4:[email protected]:5', 'panel1:right:5:[email protected]:6', 'panel1:right:6:[email protected]:7', 'panel1:right:7:[email protected]:8', 'panel1:right:8:[email protected]:9', 'panel1:right:9:[email protected]:10', 'panel1:right:10:[email protected]:11', 'panel1:right:11:[email protected]:12', 'panel1:center:0:[email protected]:13', 'panel2:right:1:[email protected]:14', 'panel1:right:1:hwmonitor@sylfurd:15', 'panel1:left:0:[email protected]:16', 'panel2:left:0:[email protected]:17']"
gsettings set org.cinnamon favorite-apps "['firefox.desktop', 'org.gnome.Software.desktop', 'cinnamon-settings.desktop', 'org.gnome.Terminal.desktop', 'nemo.desktop', 'gnome-system-monitor.desktop']"
gsettings set org.cinnamon.desktop.keybindings looking-glass-keybinding "[]"
gsettings set org.cinnamon.desktop.keybindings.wm panel-run-dialog "['<Super>r']"
gsettings set org.cinnamon.desktop.keybindings.media-keys screensaver "['<Super>l', 'XF86ScreenSaver']"
gsettings set org.cinnamon window-effect-speed "0"
gsettings set org.cinnamon.sounds notification-file '/usr/share/mint-artwork/sounds/map.oga'
gsettings set org.cinnamon.sounds switch-enabled false
gsettings set org.cinnamon.sounds tile-enabled false
gsettings set org.cinnamon.desktop.keybindings.media-keys screenshot "[]"
gsettings set org.cinnamon.desktop.keybindings terminal "[]"
gsettings set org.cinnamon.desktop.keybindings custom-list "['custom0', 'custom1', '__dummy__']"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/binding "['Print']"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/command "'flatpak run org.flameshot.Flameshot gui'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/name "'Take Screenshot (Flameshot)'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom1/binding "['<Primary><Alt>t']"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom1/command "'hyper'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom1/name "'Launch Terminal (Hyper)'"
}
set_redshift_config() {
echo -e "[redshift]
location-provider=manual
adjustment-method=randr
[manual]
lat=-23.633195
lon=-46.740668
" > $HOME/.config/redshift.conf
}
fix_postman_cert_error() {
DIR="$HOME/.var/app/com.getpostman.Postman/config/Postman/proxy"
mkdir -p $DIR
openssl req -subj '/C=US/CN=Postman Proxy' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout $DIR/postman-proxy-ca.key -out $DIR/postman-proxy-ca.crt
}
setup_git() {
git config --global user.name $GIT_USER
git config --global user.email $GIT_EMAIL
}
setup_ngrok() {
ngrok config add-authtoken $NGROK_AUTHTOKEN
echo -e "
ngrok-serve() {
ngrok http --url=accepted-deciding-hog.ngrok-free.app \$1
}
" | tee -a ~/.bashrc
}
add_update_all_command() {
echo -e "
update-all() {
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo flatpak update -y
cinnamon-spice-updater --update-all
}
" | tee -a ~/.bashrc
}
install_transfersh() {
CURRENT=$(pwd)
git clone https://github.com/dutchcoders/transfer.sh.git $HOME/Git/transfersh
cd $HOME/Git/transfersh
go build -o transfersh main.go
cd $CURRENT
mkdir -p $HOME/transfer.sh/data
mkdir -p $HOME/transfer.sh/temp
mkdir -p $HOME/transfer.sh/bin
mv $HOME/Git/transfersh/transfersh $HOME/transfer.sh/bin/transfersh
rm -rf $HOME/Git/transfersh
echo -e "
#!/bin/sh
$HOME/transfer.sh/bin/transfersh --provider=local --listener :7237 --temp-path=$HOME/transfer.sh/temp --basedir=$HOME/transfer.sh/data
" | tee $HOME/bin/transfersh
chmod +x $HOME/bin/transfersh
}
add_fix_flatpak_fonts_command() {
echo -e "
fix-flatpak-fonts() {
flatpak list --columns=application | xargs -I %s -- flatpak run --command=fc-cache %s -f -v
}
" | tee -a ~/.bashrc
}
add_fix_vscode_context_menu_command() {
echo -e "
fix-vscode-context-menu() {
if [ -f "/usr/share/applications/code.desktop" ]; then
sed -i '/MimeType/c\MimeType=text/plain;inode/directory;application/x-code-workspace;' /usr/share/applications/code.desktop
update-desktop-database
fi
}
" | tee -a ~/.bashrc
}
ask_reboot() {
echo 'Reboot now? (y/n)'
while true; do
read choice
if [[ "$choice" == 'y' || "$choice" == 'Y' ]]; then
reboot
exit 0
fi
if [[ "$choice" == 'n' || "$choice" == 'N' ]]; then
break
fi
done
}
main() {
check_root_user
show_message "Installing Node Version Manager (nvm)"
install_nvm
show_message "Downloading and installing Cinnamon Applets and Themes"
download_extensions
show_message "Setting dconf options"
set_dconf_settings
show_message "Generating Postman Certificates"
fix_postman_cert_error
show_message "Setting up Git"
setup_git
show_message "Setting up Ngrok"
setup_ngrok
show_message "Adding update-all command"
add_update_all_command
show_message "Adding fix-flatpak-fonts command"
add_fix_flatpak_fonts_command
show_message "Adding fix-vscode-context-menu command"
add_fix_vscode_context_menu_command
show_message "Installing transfer.sh"
install_transfersh
show_message "Finished!"
echo "It's recommended to reboot your system."
ask_reboot
}
(return 2> /dev/null) || main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment