diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..a584819 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["ms-python.python"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..aa5c9ac --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["developomp", "pamac"] +} diff --git a/README.md b/README.md index 9e039ee..cc64a54 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ My Arch Linux desktop setup -[![LICENSE: MIT](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](./LICENSE) - ## Purpose This repo is here to provide myself materials (script, guide, config files, and other files) for cases when I need to transfer to other machine or reinstall the OS. @@ -33,31 +31,31 @@ This repo is here to provide myself materials (script, guide, config files, and -## Instructions +## Usage -> **WARNING:** -> -> - This script is written for my laptop ONLY. -> - The script assumes a clean installation (no unnecessary packages installed already). +### WARNING -1. Install arch linux via [archfi](https://github.com/MatMoul/archfi). +- This script is written to work in my hardware **EXCLUSIVELY**. +- The script assumes a clean installation of arch linux. That is, no extra packages installed already. - - latest arch linux version as of writing: `2021.10.01` +### Instructions -2. Create user `pomp` +1. Install arch linux via [archfi](https://github.com/MatMoul/archfi) (included installer via [archinstall](https://github.com/archlinux/archinstall) coming soon). + +2. download the setup script ```bash - useradd -m pomp # create user and home directory - EDITOR=vim visudo # edit sudoers file with vim - # enable wheel group - usermod -aG wheel pomp # give pomp sudo access + curl -LO setup.developomp.com ``` -3. Execute the [`setup.sh`](./setup.sh) script. -4. Profit. +3. Execute it. Full setup could easily take more than a hour depending on the internet speed. +## How does it work? + +[Github pages](https://pages.github.com) allows the developers to deploy a static website using a branch of their repositories to store the static files. I set up github action so that the [`setup.py`](./setup.py) script gets copied to the `index.html` file in the [`gh-pages`](https://github.com/developomp/setup/tree/gh-pages) branch where it is deployed to https://setup.developomp.com. The script then downloads necessary files and packages when necessary. + ## Hardware | name | model | @@ -143,7 +141,4 @@ commit: aecec82 ## Future - 1TB HDD for long-term backup -- [Framework laptop](https://frame.work) - - AMD eGPU - - Waiting for: 120+Hz display - - Waiting for: Korean keyboard +- [wannabuy](https://developomp.com/wannabuy) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e5a0d9b --- /dev/null +++ b/setup.py @@ -0,0 +1 @@ +#!/usr/bin/env python3 diff --git a/setup.sh b/setup.sh deleted file mode 100755 index 2cb734d..0000000 --- a/setup.sh +++ /dev/null @@ -1,1001 +0,0 @@ -#!/bin/bash - -# don't remove line after package_install -# it will result in this syntax error: unexpected end of file - -# #################### [ ESSENTIALS ] #################### -# Installs essential packages and defining important functions - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -DATA_PATH="/media/pomp/data" -POST_INSTALL=() - -BOLD="\e[1m" -RESET="\e[0m" - -RED="\e[91m" # actually light red -GREEN="\e[92m" # actually light green -YELLOW="\e[33m" - -log_no_label() { - echo -e "$GREEN$BOLD$*$RESET" -} - -warn_no_label() { - echo -e "$YELLOW$BOLD$*$RESET" -} - -error_no_label() { - echo -e "$RED$BOLD$*$RESET" -} - -log() { - echo -e " $GREEN$BOLD INFO | $*$RESET" -} - -warn() { - echo -e " $YELLOW$BOLD WARNING | $*$RESET" -} - -error() { - echo >&2 -e " $RED$BOLD ERROR | $*$RESET" -} - -title() { - echo - echo -e "$BOLD$GREEN====================[ $* ]====================$RESET" -} - -smart_mkdir() { - # make directory recursively if it doesn't exist already - - if [ ! -d "$1" ]; then - mkdir -p "$1" - fi -} - -package_install() { - pamac install --no-confirm "$@" -} - -package_remove() { - pamac remove --no-confirm "$@" -} - -setup_essentials() { - setup_fstab - sudo pacman -S --needed base-devel wget - - # install pamac if it does not exist - if ! command -v pamac &>/dev/null; then - log "pamac was not installed already. Installing now..." - setup_pamac - fi - - # install dialog if it's not installed already - if ! command -v dialog &>/dev/null; then - log "dialog was not installed already. Installing now..." - package_install dialog - fi -} - -load_dconf() { - dconf load / <"./dconf/$1" -} - -# #################### [ DEFINING SETUP ] #################### -# Define instructions on how to setup applications & stuff - -setup_alacritty() { - package_install alacritty - - mkdir ~/.config/alacritty/ - install ./home/pomp/.config/alacritty/alacritty.yml ~/.config/alacritty/ -} - -setup_blender() { - package_install blender -} - -setup_brave() { - # brave://sync-internals/ - - package_install brave-bin - - install ./home/pomp/.config/autostart/brave-browser.desktop ~/.config/autostart/ - - # settings: DNS https cloudflare - POST_INSTALL+=( - "brave: sync device" - "brave: restore onetab" - ) -} - -setup_btop() { - # top but better - package_install btop -} - -setup_cpu_undervolting() { - # intel CPU undervolting for less heat and power consumption - # 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 install --backup $config_file $config_file.bak - - # Explanation: - # for lines that are not comments (lines that do not start with a hash) - # search for "undervolt '' " - # and replaces with "undervolt '' -100 " - # 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_deno() { - package_install deno -} - -setup_discord() { - # assumes that plugins are located in ~/.config/BetterDiscord/plugins - - # betterdiscordctl-git: BetterDiscord installer - - package_install \ - discord \ - betterdiscordctl-git - - install ./home/pomp/.config/autostart/discord.desktop ~/.config/autostart/ - - BD_PLUGINS=( - 134 # https://betterdiscord.app/plugin/Avatar%20Hover - 60 # https://betterdiscord.app/plugin/BadgesEverywhere - 119 # https://betterdiscord.app/plugin/BetterCodeblocks - 62 # https://betterdiscord.app/plugin/BetterNsfwTag - 63 # https://betterdiscord.app/plugin/BetterSearchPage - 228 # https://betterdiscord.app/plugin/CallTimeCounter - 64 # https://betterdiscord.app/plugin/CharCounter - 67 # https://betterdiscord.app/plugin/CompleteTimestamps - 176 # https://betterdiscord.app/plugin/Copier - 68 # https://betterdiscord.app/plugin/CopyRawMessage - 69 # https://betterdiscord.app/plugin/CreationDate - 186 # https://betterdiscord.app/plugin/DoNotTrack - 132 # https://betterdiscord.app/plugin/EmoteReplacer - 245 # https://betterdiscord.app/plugin/FreeEmojis - 81 # https://betterdiscord.app/plugin/GoogleTranslateOption - 284 # https://betterdiscord.app/plugin/GrammarCorrect - 220 # https://betterdiscord.app/plugin/GuildProfile - 83 # https://betterdiscord.app/plugin/ImageUtilities - 295 # https://betterdiscord.app/plugin/InvisibleTyping - 84 # https://betterdiscord.app/plugin/JoinedAtDate - 85 # https://betterdiscord.app/plugin/LastMessageDate - 287 # https://betterdiscord.app/plugin/Link-Profile-Picture - 11 # https://betterdiscord.app/plugin/MemberCount - 29 # https://betterdiscord.app/plugin/PermissionsViewer - 158 # https://betterdiscord.app/plugin/PlatformIndicators - 93 # https://betterdiscord.app/plugin/QuickMention - 94 # https://betterdiscord.app/plugin/ReadAllNotificationsButton - 179 # https://betterdiscord.app/plugin/RedditMentions - 97 # https://betterdiscord.app/plugin/RevealAllSpoilersOption - 98 # https://betterdiscord.app/plugin/SendLargeMessages - 159 # https://betterdiscord.app/plugin/ShowAllActivities - 291 # https://betterdiscord.app/plugin/ShowConnections - 103 # https://betterdiscord.app/plugin/ShowHiddenChannels - 104 # https://betterdiscord.app/plugin/SpellCheck - 162 # https://betterdiscord.app/plugin/StaffTag - 8 # https://betterdiscord.app/plugin/SuppressReplyMentions - 253 # https://betterdiscord.app/plugin/Typing%20Users%20Avatars - 196 # https://betterdiscord.app/plugin/TypingIndicator - 293 # https://betterdiscord.app/plugin/UserDetails - ) - - log "installing betterdiscord plugins" - - for id in "${BD_PLUGINS[@]}"; do - BD_PLUGIN_URL="https://betterdiscord.app/Download?id=$id" - log "installing $BD_PLUGIN_URL" - wget --content-disposition --no-clobber -P ~/.config/BetterDiscord/plugins "$BD_PLUGIN_URL" - done - - POST_INSTALL+=("discord: run betterdiscordctl install") -} - -setup_docker() { - package_install docker - - sudo usermod -aG docker "${USER}" - sudo systemctl --now enable docker -} - -setup_dotnet() { - package_install dotnet-sdk -} - -setup_filezilla() { - package_install filezilla -} - -setup_fonts() { - log "installing fonts" - - # wget: For downloading zip files - # noto-fonts-emoji: Emoji fonts - # nerd-fonts-noto-sans-mono: Terminal font - # ttf-baekmuk: Korean font - - package_install \ - wget \ - noto-fonts-emoji \ - nerd-fonts-noto-sans-mono \ - ttf-baekmuk - - # path to temporarily save font related files - fonts_directory="$SCRIPT_DIR/tmp/fonts" - - # fonts to download - font_names=( - "Audiowide" - "Varela Round" - "Ubuntu Mono" - "Nanum Gothic Coding" - ) - - # create fonts directory if it does not exist - if [ ! -d "$fonts_directory" ]; then - mkdir -p "$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 -p "$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_freetube() { - pamac install freetube-bin - - # todo: freetube data -} - -setup_fstab() { - if cat /etc/fstab | grep "/media/pomp/data" &>/dev/null; then - return - fi - - echo "UUID=1cea13a5-ea19-4023-99dd-4bfd062a288c /media/pomp/data ext4 defaults 0 2" | sudo tee -a /etc/fstab >/dev/null - log "added /media/pomp/data to fstab" -} - -setup_dns() { - : - # https://1.1.1.1 -} - -setup_geogebra() { - package_install geogebra -} - -setup_gimp() { - # photoshop but FOSS - - package_install gimp -} - -setup_git() { - package_install git - - git config --global user.email "developomp@gmail.com" - git config --global user.name "developomp" - git config --global pull.rebase false - git config --global init.defaultBranch master -} - -setup_gnome() { - # gnome, nvidia driver, and optimus manager - - # gdm-prime gdm patched for optimus laptops - # vimix-cursors cursors - # vimix-gtk-themes-git gtk theme - # papirus-icon-theme icon theme - # gnome-backgrounds wallpapers and shit - # gwe nvidia GPU overclocking https://gitlab.com/leinardi/gwe - # nvidia nvidia GPU support - # nvidia-settings nvidia settings - # lib32-nvidia-utils 32bit nvidia driver utils - # optimus-manager-qt https://github.com/Shatur/optimus-manager-qt - - package_install \ - gdm-prime \ - vimix-cursors \ - vimix-gtk-themes-git \ - papirus-icon-theme \ - gnome-backgrounds \ - gwe \ - nvidia \ - nvidia-settings \ - lib32-nvidia-utils \ - optimus-manager-qt - - sudo systemctl enable gdm - sudo systemctl enable optimus-manager - - install ./home/pomp/.config/autostart/gwe.desktop ~/.config/autostart/ - install ./home/pomp/.config/autostart/io.optimus_manager.OptimusManagerQt.desktop ~/.config/autostart/ - - # prevent rootless X - sudo install -g root -o root -m u=rw,g=r,o=r ./etc/X11/Xwrapper.config /etc/X11/Xwrapper.config - load_dconf "gnome-desktop-interface.conf" - - # set nvidia preferred mode on login - install ./home/pomp/.nvidia-preferred-mode.sh ~/ - install ./home/pomp/.config/autostart/nvidia-preferred-mode.desktop ~/.config/autostart/ - - setup_gnome_apps - setup_alacritty # so I have a terminal to work with when only gnome is installed - - cat >~/.config/user-dirs.dirs <"$SCRIPT_DIR/dconf$TIMESTAMP.conf" - - # make a home directory backup - rsync -a --info=progress2 --perms /home/pomp "$DATA_PATH/backup$TIMESTAMP" - - # create timeshift backup - if ! command -v timeshift &>/dev/null; then - error "failed to create timeshift backup. Timeshift command not found." - else - sudo timeshift --create --comments "auto created by developomp setup script ($TIMESTAMP)" - fi -} - -setup_local() { - # setup for applications in second drive - # add to application menu - - if [[ -d /media/pomp/data/programs/dnSpy-net-win32 ]]; then - log "dnspy" - fi - - if [[ -d /media/pomp/data/programs/tor-browser ]]; then - log "tor browser" - fi -} - -# #################### [ TEST ] #################### -# Tests if script is ready to be executed - -# check if script is running as root -if [[ ! $EUID -ne 0 ]]; then - error "DO NOT RUN THIS SCRIPT AS ROOT" - exit 1 -fi - -# check internet connection -if ! ping -c 1 archlinux.org &>/dev/null; then - error "You are not connected to the internet" -fi - -# #################### [ START ] #################### - -# move to script directory (repo root) -cd "$SCRIPT_DIR" || { - error "FAILED TO GO TO SCRIPT DIRECTORY" - exit -} - -# remove temporary files and folders that was not removed from previous run -rm -rf "./tmp" - -echo -warn_no_label "NOTICE" -warn_no_label " This is not a completely hands off process." -warn_no_label " You need to monitor the process and take appropriate actions." -echo - -read -p "Press (y) to continue. Press any other key to exit: " -n 1 -r -if [[ $REPLY =~ ^[^Yy]$ ]]; then - echo - exit -fi -echo - -# #################### [ MAIN ] #################### - -setup_essentials - -options=( - "alacritty" "" off - "backup" "" off - "blender" "" off - "brave" "" off - "btop" "" off - "cpu_undervolting" "" off - "deno" "" off - "discord" "" off - "docker" "" off - "dotnet" "" off - "filezilla" "" off - "fonts" "" off - "freetube" "" off - "fstab" "" off - "geogebra" "" off - "gimp" "" off - "git" "" off - "gnome" "" off - "gnome_apps" "" off - "gnome_extensions" "" off - "go" "" off - "godot" "" off - "grub" "" off - "gsmartcontrol" "" off - "inkscape" "" off - "jdk" "" off - "kdenlive" "" off - "keyboard" "" off - "obs" "" off - "ordne" "" off - "osu" "" off - "middleclickpaste" "" off - "mystiq" "" off - "node" "" off - "pavucontrol" "" off - "pamac" "" off - "pip" "" off - "piper" "" off - "pomky" "" off - "rust" "" off - "shfmt" "" off - "steam" "" off - "timeshift" "" off - "unity" "" off - "vim" "" off - "virtualbox" "" off - "vlc" "" off - "vscodium" "" off - "wine" "" off - "wireshark" "" off - "office" "" off - "zoom" "" off - "zsh" "" off -) - -# choose from available options -cmd=(dialog --separate-output --checklist "Select Setup Operations to perform" 20 50 5) -choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) -clear -for choice in $choices; do - case "$choice" in - "alacritty") setup_alacritty ;; - "blender") setup_blender ;; - "brave") setup_brave ;; - "btop") setup_btop ;; - "backup") backup ;; - "cpu_undervolting") setup_cpu_undervolting ;; - "deno") setup_deno ;; - "discord") setup_discord ;; - "docker") setup_docker ;; - "dotnet") setup_dotnet ;; - "filezilla") setup_filezilla ;; - "fonts") setup_fonts ;; - "freetube") setup_freetube ;; - "fstab") setup_fstab ;; - "geogebra") setup_geogebra ;; - "gimp") setup_gimp ;; - "git") setup_git ;; - "gnome") setup_gnome ;; - "gnome_apps") setup_gnome_apps ;; - "gnome_extensions") setup_gnome_extensions ;; - "go") setup_go ;; - "godot") setup_godot ;; - "grub") setup_grub ;; - "gsmartcontrol") setup_gsmartcontrol ;; - "inkscape") setup_inkscape ;; - "jdk") setup_jdk ;; - "kdenlive") setup_kdenlive ;; - "keyboard") setup_keyboard ;; - "obs") setup_obs ;; - "ordne") setup_ordne ;; - "osu") setup_osu ;; - "middleclickpaste") setup_middleclickpaste ;; - "mystiq") setup_mystiq ;; - "node") setup_node ;; - "pavucontrol") setup_pavucontrol ;; - "pamac") setup_pamac ;; - "pip") setup_pip ;; - "piper") setup_piper ;; - "pomky") setup_pomky ;; - "rust") setup_rust ;; - "shfmt") setup_shfmt ;; - "steam") setup_steam ;; - "timeshift") setup_timeshift ;; - "unity") setup_unity ;; - "vim") setup_vim ;; - "virtualbox") setup_virtualbox ;; - "vlc") setup_vlc ;; - "vscodium") setup_vscodium ;; - "wine") setup_wine ;; - "wireshark") setup_wireshark ;; - "office") setup_office ;; - "zoom") setup_zoom ;; - "zsh") setup_zsh ;; - esac -done - -# #################### [ CLEANUP ] #################### - -# remove temporary directory -rm -rf "$SCRIPT_DIR/tmp" - -# #################### [ DONE ] #################### -# print some info after installation - -title "DONE" - -echo - -# show what to do manually -if [ ! ${#POST_INSTALL[@]} -eq 0 ]; then - log_no_label "now:" - - for doWhat in "${POST_INSTALL[@]}"; do - log_no_label " - $doWhat" - done -fi