1
0
Fork 0

removed unused variables

fixed code using shellcheck
arranged setup functions alhabetically
This commit is contained in:
Kim, Jimin 2021-07-10 09:21:56 +09:00
parent 6a2a25506e
commit a5fa947a36

646
setup.sh
View file

@ -9,12 +9,7 @@
# https://stackoverflow.com/a/246128/12979111
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $SCRIPT_DIR
BOLD="\e[1m"
DIM="\e[2m"
UNDERLINE="\e[4m"
INVERT="\e[7m"
RESET="\e[0m"
RED="\e[91m" # actually light red
@ -22,42 +17,42 @@ GREEN="\e[92m" # actually light green
YELLOW="\e[33m"
log_no_label() {
echo -e "$GREEN$BOLD$@$RESET"
echo -e "$GREEN$BOLD$*$RESET"
}
warn_no_label() {
echo -e "$YELLOW$BOLD$@$RESET"
echo -e "$YELLOW$BOLD$*$RESET"
}
error_no_label() {
echo -e "$RED$BOLD$@$RESET"
echo -e "$RED$BOLD$*$RESET"
}
log() {
echo -e " $GREEN$BOLD INFO | $@$RESET"
echo -e " $GREEN$BOLD INFO | $*$RESET"
}
warn() {
echo -e " $YELLOW$BOLD WARNING | $@$RESET"
echo -e " $YELLOW$BOLD WARNING | $*$RESET"
}
error() {
>&2 echo -e " $RED$BOLD ERROR | $@$RESET"
>&2 echo -e " $RED$BOLD ERROR | $*$RESET"
}
title() {
echo
echo -e "$BOLD$GREEN====================[ $@ ]====================$RESET"
echo -e "$BOLD$GREEN====================[ $* ]====================$RESET"
}
package_install() {
pamac install $@
pamac install "$@"
}
# #################### [ DEFINING ESSENTIAL SETUP ] ####################
backup() {
dconf dump / > $SCRIPT_DIR/dconf.conf
dconf dump / > "$SCRIPT_DIR/dconf.conf"
# copy /home/pomp directory
# timeshift settings
sudo timeshift --create --comments "auto created by developomp setup script"
@ -101,8 +96,6 @@ install_essentials() {
python-pip `# python package management` \
ranger `# CLI File manager` \
sqlitebrowser `# ` \
steam `# ` \
steam-native-runtime `# ` \
timeshift `# system backup` \
transmission-gtk `# torrent client` \
unityhub `# game development` \
@ -118,6 +111,172 @@ install_essentials() {
# Define instructions on how to setup applications & stuff
# Assumes all essential packages are installed already (git, vim, etc.)
setup_conky() {
package_install \
conky \
vnstat `# network traffic statistics (for conky)` \
# enable on startup
# sudo systemctl enable vnstat
# sudo systemctl start vnstat
}
setup_cpu_undervolting() {
# Undervolting for intel CPU
# https://wiki.archlinux.org/index.php/Undervolting_CPU
package_install \
intel-undervolt \
config_file=/etc/intel-undervolt.conf
# create backup in case anything goes wrong
sudo cp $config_file $config_file.bak
# Explanation:
# for lines that are not comments (lines that do not start with a hash)
# search for "undervolt <number> '<field>' <original value><comment>"
# and replaces with "undervolt <number> '<field>' -100 <comment>"
# This method does not preserve the space between the value and the comment.
# So this:
# value # space between comment and value: 2
# becomes this:
# value # space between comment and value: 1
sudo sed -i -e "/^[^#]/s/\(undervolt [0-9]* 'CPU'\) .*\(#.*\)/\1 -100 \2/" $config_file
sudo sed -i -e "/^[^#]/s/\(undervolt [0-9]* 'CPU Cache'\) .*\(#.*\)/\1 -100 \2/" $config_file
sudo intel-undervolt apply
sudo systemctl enable intel-undervolt
}
setup_dconf() {
# todo: freon GPU, decimal, and unit
# must be done after install to make sure configs are not overwritten
dconf load / < $SCRIPT_DIR/dconf.conf
}
setup_discord() {
package_install \
discord `# discord` \
betterdiscord-installer `# installer for betterdiscord` \
discord-overlay-git `# overlay for discord` \
# BD plugins
# https://betterdiscord.app/plugin/Avatar%20Hover
# https://betterdiscord.app/plugin/BadgesEverywhere
# https://betterdiscord.app/plugin/BetterCodeblocks
# https://betterdiscord.app/plugin/BetterNsfwTag
# https://betterdiscord.app/plugin/BetterSearchPage
# https://betterdiscord.app/plugin/CallTimeCounter
# https://betterdiscord.app/plugin/CharCounter
# https://betterdiscord.app/plugin/CompleteTimestamps
# https://betterdiscord.app/plugin/Copier
# https://betterdiscord.app/plugin/CopyRawMessage
# https://betterdiscord.app/plugin/CreationDate
# https://betterdiscord.app/plugin/DoNotTrack
# https://betterdiscord.app/plugin/EmoteReplacer
# https://betterdiscord.app/plugin/FreeEmojis
# https://betterdiscord.app/plugin/GoogleTranslateOption
# https://betterdiscord.app/plugin/GrammarCorrect
# https://betterdiscord.app/plugin/GuildProfile
# https://betterdiscord.app/plugin/ImageUtilities
# https://betterdiscord.app/plugin/InvisibleTyping
# https://betterdiscord.app/plugin/JoinedAtDate
# https://betterdiscord.app/plugin/LastMessageDate
# https://betterdiscord.app/plugin/Link-Profile-Picture
# https://betterdiscord.app/plugin/MemberCount
# https://betterdiscord.app/plugin/PermissionsViewer
# https://betterdiscord.app/plugin/PlatformIndicators
# https://betterdiscord.app/plugin/QuickMention
# https://betterdiscord.app/plugin/ReadAllNotificationsButton
# https://betterdiscord.app/plugin/RedditMentions
# https://betterdiscord.app/plugin/RevealAllSpoilersOption
# https://betterdiscord.app/plugin/SecretRingTone
# https://betterdiscord.app/plugin/SendLargeMessages
# https://betterdiscord.app/plugin/ServerCounter
# https://betterdiscord.app/plugin/ShowAllActivities
# https://betterdiscord.app/plugin/ShowConnections
# https://betterdiscord.app/plugin/ShowHiddenChannels
# https://betterdiscord.app/plugin/SpellCheck
# https://betterdiscord.app/plugin/StaffTag
# https://betterdiscord.app/plugin/SuppressReplyMentions
# https://betterdiscord.app/plugin/Typing%20Users%20Avatars
# https://betterdiscord.app/plugin/TypingIndicator
# https://betterdiscord.app/plugin/UserDetails
}
setup_dns() {
:
# https://1.1.1.1
}
setup_firefox() {
package_install firefox-developer-edition
# DNS https cloudflare
}
setup_fonts() {
echo "installing fonts"
# path to temporarily save font related files
fonts_directory="./fonts"
# fonts to download
font_names=(
"Audiowide"
"Comfortaa"
"Nanum Gothic"
"Source Code Pro"
)
# create fonts directory if it does not exist
if [ ! -d "$fonts_directory" ]; then
mkdir "$fonts_directory"
fi
# download and unzip font files if they're not downloaded already
for font_name in "${font_names[@]}"; do
zip_path="$fonts_directory/$font_name.zip"
# download and unzip if either zip file or unzipped directory exists
if [ ! -f "$zip_path" ] && [ ! -d "$fonts_directory/$font_name" ]; then
wget -O "$zip_path" "https://fonts.google.com/download?family=$font_name" # download zip file
unzip "$zip_path" -d "$fonts_directory/$font_name" # unzip file
rm "$zip_path" # remove zip file
fi
done
font_install_dir="$HOME/.local/share/fonts"
# create local fonts directory if it does not exist already
if [ ! -d "$font_install_dir" ]; then
mkdir "$font_install_dir"
fi
# "install" all fonts
find "$fonts_directory" -type f -name "*.ttf" | while read ttf_file_path ; do
mv -f "$ttf_file_path" "$font_install_dir/${ttf_file_path##*/}"
done
# regenerate font cache
fc-cache -vf
# cleanup
rm -rf $fonts_directory
package_install \
noto-fonts-emoji `# ` \
ttf-ms-win10 `# ` \
nerd-fonts-noto-sans-mono `# Terminal font` \
}
setup_gimp() {
package_install \
gimp `# image editing` \
}
setup_gnome() {
package_install \
baobab `# Disk usage analysis` \
@ -175,279 +334,36 @@ setup_gnome() {
killall -3 gnome-shell
}
setup_discord() {
setup_go() {
package_install \
discord `# discord` \
betterdiscord-installer `# installer for betterdiscord` \
discord-overlay-git `# overlay for discord` \
go \
# BD plugins
# https://betterdiscord.app/plugin/Avatar%20Hover
# https://betterdiscord.app/plugin/BadgesEverywhere
# https://betterdiscord.app/plugin/BetterCodeblocks
# https://betterdiscord.app/plugin/BetterNsfwTag
# https://betterdiscord.app/plugin/BetterSearchPage
# https://betterdiscord.app/plugin/CallTimeCounter
# https://betterdiscord.app/plugin/CharCounter
# https://betterdiscord.app/plugin/CompleteTimestamps
# https://betterdiscord.app/plugin/Copier
# https://betterdiscord.app/plugin/CopyRawMessage
# https://betterdiscord.app/plugin/CreationDate
# https://betterdiscord.app/plugin/DoNotTrack
# https://betterdiscord.app/plugin/EmoteReplacer
# https://betterdiscord.app/plugin/FreeEmojis
# https://betterdiscord.app/plugin/GoogleTranslateOption
# https://betterdiscord.app/plugin/GrammarCorrect
# https://betterdiscord.app/plugin/GuildProfile
# https://betterdiscord.app/plugin/ImageUtilities
# https://betterdiscord.app/plugin/InvisibleTyping
# https://betterdiscord.app/plugin/JoinedAtDate
# https://betterdiscord.app/plugin/LastMessageDate
# https://betterdiscord.app/plugin/Link-Profile-Picture
# https://betterdiscord.app/plugin/MemberCount
# https://betterdiscord.app/plugin/PermissionsViewer
# https://betterdiscord.app/plugin/PlatformIndicators
# https://betterdiscord.app/plugin/QuickMention
# https://betterdiscord.app/plugin/ReadAllNotificationsButton
# https://betterdiscord.app/plugin/RedditMentions
# https://betterdiscord.app/plugin/RevealAllSpoilersOption
# https://betterdiscord.app/plugin/SecretRingTone
# https://betterdiscord.app/plugin/SendLargeMessages
# https://betterdiscord.app/plugin/ServerCounter
# https://betterdiscord.app/plugin/ShowAllActivities
# https://betterdiscord.app/plugin/ShowConnections
# https://betterdiscord.app/plugin/ShowHiddenChannels
# https://betterdiscord.app/plugin/SpellCheck
# https://betterdiscord.app/plugin/StaffTag
# https://betterdiscord.app/plugin/SuppressReplyMentions
# https://betterdiscord.app/plugin/Typing%20Users%20Avatars
# https://betterdiscord.app/plugin/TypingIndicator
# https://betterdiscord.app/plugin/UserDetails
}
setup_cpu_undervolting() {
# Undervolting for intel CPU
# https://wiki.archlinux.org/index.php/Undervolting_CPU
setup_grub_theme() {
# only show when esc is pressed
# check how manjaro did it
package_install grub-theme-vimix
}
setup_inkscape() {
package_install \
intel-undervolt \
inkscape \
config_file=/etc/intel-undervolt.conf
# create backup in case anything goes wrong
sudo cp $config_file $config_file.bak
# Explanation:
# for lines that are not comments (lines that do not start with a hash)
# search for "undervolt <number> '<field>' <original value><comment>"
# and replaces with "undervolt <number> '<field>' -100 <comment>"
# This method does not preserve the space between the value and the comment.
# So this:
# value # space between comment and value: 2
# becomes this:
# value # space between comment and value: 1
sudo sed -i -e "/^[^#]/s/\(undervolt [0-9]* 'CPU'\) .*\(#.*\)/\1 -100 \2/" $config_file
sudo sed -i -e "/^[^#]/s/\(undervolt [0-9]* 'CPU Cache'\) .*\(#.*\)/\1 -100 \2/" $config_file
sudo intel-undervolt apply
sudo systemctl enable intel-undervolt
}
setup_font() {
echo "installing fonts"
# path to temporarily save font related files
fonts_directory="./fonts"
# fonts to download
font_names=(
"Audiowide"
"Comfortaa"
"Nanum Gothic"
"Source Code Pro"
)
# create fonts directory if it does not exist
if [ ! -d "$fonts_directory" ]; then
mkdir "$fonts_directory"
fi
# download and unzip font files if they're not downloaded already
for font_name in "${font_names[@]}"; do
zip_path="$fonts_directory/$font_name.zip"
# download and unzip if either zip file or unzipped directory exists
if [ ! -f "$zip_path" ] && [ ! -d "$fonts_directory/$font_name" ]; then
wget -O "$zip_path" "https://fonts.google.com/download?family=$font_name" # download zip file
unzip "$zip_path" -d "$fonts_directory/$font_name" # unzip file
rm "$zip_path" # remove zip file
fi
done
font_install_dir="$HOME/.local/share/fonts"
# create local fonts directory if it does not exist already
if [ ! -d "$font_install_dir" ]; then
mkdir "$font_install_dir"
fi
# "install" all fonts
find "$fonts_directory" -type f -name "*.ttf" | while read ttf_file_path ; do
mv -f "$ttf_file_path" "$font_install_dir/${ttf_file_path##*/}"
done
# regenerate font cache
fc-cache -vf
# cleanup
rm -rf $fonts_directory
setup_java() {
package_install \
noto-fonts-emoji `# ` \
ttf-ms-win10 `# ` \
nerd-fonts-noto-sans-mono `# Terminal font` \
intellij-idea-community-edition `# java development` \
jdk `# oracle java development kit` \
jdk8 `# ` \
}
setup_wireshart() {
package_install wireshark-gtk2
sudo usermod -a -G wireshark $USER
}
setup_middleclickpaste() {
setup_kdenlive() {
:
# make it autostart
}
setup_node() {
package_install \
nodejs `# ` \
npm `# javascript development` \
deno `# node++ thingy` \
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
# export PATH="$(yarn global bin):$PATH"
}
setup_dns() {
:
# https://1.1.1.1
}
setup_unity() {
package_install unityhub
# editors location for unity hub (`/media/pomp/data/programs/Unity Hub/Unity Editors`)
# vscode setup
}
setup_virtualbox() {
# https://wiki.archlinux.org/title/VirtualBox
package_install \
virtualbox `# OS emulation` \
virtualbox-host-modules-arch `# ` \
virtualbox-guest-iso `# ` \
virtualbox-ext-oracle
sudo vboxreload
sudo modprobe vboxdrv
}
setup_optimus_manager() {
# Not using power switching
# read this wiki[1] about power management with acpi call for more information
# [1] https://github.com/Askannz/optimus-manager/wiki/A-guide--to-power-management-options#configuration-4--acpi_call
package_install \
gwe `# nvidia GPU overclocking https://gitlab.com/leinardi/gwe` \
optimus-manager `# https://github.com/Askannz/optimus-manager` \
optimus-manager-qt `# https://github.com/Shatur/optimus-manager-qt` \
# launch on startup
# nvidia as default
# Performance: 265, 750
# Energy Saver: -155, -365
}
setup_minecraft() {
package_install \
minecraft-launcher `# ` \
worldpainter `# ` \
minecraft-overviewer `# ` \
# mcaselector (/usr/lib/jvm/java-15-openjdk/bin/java --module-path /media/pomp/data/master_folder/programming/java/javafx-sdk-16/lib --add-modules ALL-MODULE-PATH -jar /usr/share/java/mcaselector.jar)
}
setup_user_directories() {
package_install xdg-user-dirs
# edit `~/.config/user-dirs.dirs`:
# XDG_DESKTOP_DIR="$HOME/Desktop"
# XDG_DOWNLOAD_DIR="/media/pomp/data/Downloads"
# XDG_TEMPLATES_DIR="$HOME/Templates"
# XDG_PUBLICSHARE_DIR="$HOME/Public"
# XDG_DOCUMENTS_DIR="/media/pomp/data/google-drive/Documents"
# XDG_MUSIC_DIR="/media/pomp/data/google-drive/Music"
# XDG_PICTURES_DIR="/media/pomp/data/google-drive/Pictures"
# XDG_VIDEOS_DIR="/media/pomp/data/Videos"
}
setup_wine() {
package_install \
wine \
wine-gecko \
wine-mono \
winetricks \
# - `WINEARCH=win32 WINEPREFIX=~/.win32/ winecfg`
# - `winetricks allfonts`
# - `winetricks settings fontsmooth=rgb`
}
setup_nvidia() {
# https://wiki.archlinux.org/title/NVIDIA
# https://wiki.archlinux.org/title/Vulkan
package_install \
cuda `# ` \
cuda-tools `# ` \
lib32-nvidia-utils `# ` \
lib32-vulkan-icd-loader `# ` \
nvidia `# ` \
nvidia-settings `# ` \
nvidia-utils `# ` \
vulkan-icd-loader `# ` \
}
setup_steam() {
#https://wiki.archlinux.org/title/Steam
package_install \
steam \
# change steam library directory (/media/pomp/data/programs/SteamLibrary)
# enable steam proton play
}
setup_conky() {
package_install \
conky \
vnstat `# network traffic statistics (for conky)` \
# enable on startup
# sudo systemctl enable vnstat
# sudo systemctl start vnstat
}
setup_dconf() {
# todo: freon GPU, decimal, and unit
# must be done after install to make sure configs are not overwritten
dconf load / < $SCRIPT_DIR/dconf.conf
# Use appimage package
# no kde dependencies
}
setup_local() {
@ -479,6 +395,78 @@ setup_local() {
# --no-sandbox
}
setup_middleclickpaste() {
:
# make it autostart
}
setup_minecraft() {
package_install \
minecraft-launcher `# ` \
worldpainter `# ` \
minecraft-overviewer `# ` \
# mcaselector (/usr/lib/jvm/java-15-openjdk/bin/java --module-path /media/pomp/data/master_folder/programming/java/javafx-sdk-16/lib --add-modules ALL-MODULE-PATH -jar /usr/share/java/mcaselector.jar)
}
setup_node() {
package_install \
nodejs `# ` \
npm `# javascript development` \
deno `# node++ thingy` \
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
# export PATH="$(yarn global bin):$PATH"
}
setup_nvidia() {
# https://wiki.archlinux.org/title/NVIDIA
# https://wiki.archlinux.org/title/Vulkan
package_install \
cuda `# ` \
cuda-tools `# ` \
lib32-nvidia-utils `# ` \
lib32-vulkan-icd-loader `# ` \
nvidia `# ` \
nvidia-settings `# ` \
nvidia-utils `# ` \
vulkan-icd-loader `# ` \
}
setup_obs() {
package_install \
obs-plugin-input-overlay-bin `# show inputs in OBS` \
obs-studio `# screen recording and streaming` \
}
setup_optimus_manager() {
# Not using power switching
# read this wiki[1] about power management with acpi call for more information
# [1] https://github.com/Askannz/optimus-manager/wiki/A-guide--to-power-management-options#configuration-4--acpi_call
package_install \
gwe `# nvidia GPU overclocking https://gitlab.com/leinardi/gwe` \
optimus-manager `# https://github.com/Askannz/optimus-manager` \
optimus-manager-qt `# https://github.com/Shatur/optimus-manager-qt` \
# launch on startup
# nvidia as default
# Performance: 265, 750
# Energy Saver: -155, -365
}
setup_osu() {
package_install \
osu-lazer \
osu \
# akatsuki server
}
setup_plymouth() {
# must be done after optimus
# https://wiki.archlinux.org/title/plymouth
@ -490,56 +478,75 @@ setup_plymouth() {
}
setup_grub_theme() {
# only show when esc is pressed
# check how manjaro did it
package_install grub-theme-vimix
setup_steam() {
package_install \
steam-manjaro \
# change steam library directory (/media/pomp/data/programs/SteamLibrary)
# enable steam proton play
}
setup_kdenlive() {
setup_shfmt() {
:
# Use appimage package
# no kde dependencies
}
setup_firefox() {
package_install firefox-developer-edition
# DNS https cloudflare
setup_unity() {
package_install unityhub
# editors location for unity hub (`/media/pomp/data/programs/Unity Hub/Unity Editors`)
# vscode setup
}
setup_java() {
setup_user_directories() {
package_install xdg-user-dirs
# edit `~/.config/user-dirs.dirs`:
# XDG_DESKTOP_DIR="$HOME/Desktop"
# XDG_DOWNLOAD_DIR="/media/pomp/data/Downloads"
# XDG_TEMPLATES_DIR="$HOME/Templates"
# XDG_PUBLICSHARE_DIR="$HOME/Public"
# XDG_DOCUMENTS_DIR="/media/pomp/data/Documents"
# XDG_MUSIC_DIR="/media/pomp/data/Music"
# XDG_PICTURES_DIR="/media/pomp/data/Pictures"
# XDG_VIDEOS_DIR="/media/pomp/data/Videos"
}
setup_virtualbox() {
# https://wiki.archlinux.org/title/VirtualBox
package_install \
intellij-idea-community-edition `# java development` \
jdk `# oracle java development kit` \
jdk8 `# ` \
virtualbox `# OS emulation` \
virtualbox-host-modules-arch `# ` \
virtualbox-guest-iso `# ` \
virtualbox-ext-oracle
sudo vboxreload
sudo modprobe vboxdrv
}
setup_vlc() {
package_install \
vlc `# audio & video playback` \
}
setup_gimp() {
setup_wine() {
package_install \
gimp `# image editing` \
wine \
wine-gecko \
wine-mono \
winetricks \
# - `WINEARCH=win32 WINEPREFIX=~/.win32/ winecfg`
# - `winetricks allfonts`
# - `winetricks settings fontsmooth=rgb`
}
setup_inkscape() {
package_install \
inkscape \
}
setup_obs() {
package_install \
obs-plugin-input-overlay-bin `# show inputs in OBS` \
obs-studio `# screen recording and streaming` \
}
setup_osu() {
package_install \
osu-lazer \
osu \
# akatsuki server
setup_wireshart() {
package_install wireshark-gtk2
sudo usermod -a -G wireshark $USER
}
setup_wps_office() {
@ -549,18 +556,6 @@ setup_wps_office() {
}
setup_go() {
package_install \
go \
}
setup_vlc() {
package_install \
vlc `# audio & video playback` \
}
setup_zoom() {
package_install zoom
}
@ -571,6 +566,11 @@ setup() {
# #################### [ START ] ####################
cd "$SCRIPT_DIR" || {
error "FAILED TO FIND SCRIPT DIRECTORY"
exit
}
echo
warn_no_label "NOTICE"
warn_no_label "This is not a completely hands off process."
@ -630,4 +630,4 @@ echo
log_no_label "now:"
log_no_label "- sign in to firefox & vscode"
log_no_label "- restore onetab"
log_no_label "- setup korean keyboard"
log_no_label "- setup korean keyboard after reboot"