├── README.md ├── apps.csv ├── experiments.sh ├── install_apps.sh ├── install_chroot.sh ├── install_sys.sh ├── install_user.sh ├── screen.png ├── screen_780.png └── sudoers /README.md: -------------------------------------------------------------------------------- 1 | # Phantas0s Arch Install 2 | 3 | [![Mousless Development Environment](screen_780.png)](screen.png) 4 | 5 | This is my scripts to install easily Arch Linux. 6 | 7 | **WARNING**: This set of script should be used for inspiration, don't run them on your system. If you want to try to install everything (I would advise you to use a VM) you have to 8 | 9 | 1. `curl` the first script `install_sys.sh` (`curl -LO https://raw.githubusercontent.com/Phantas0s/ArchInstall/master/install_sys.sh && sh install_sys.sh`) 10 | 2. Change the function `url_installer` in the file if you want to. 11 | 3. Launch it. 12 | 13 | Then, follow the instructions. Don't expect a lot of choices though. 14 | 15 | ## What's in there? 16 | 17 | Every scripts are called from `install_sys.sh`. 18 | 19 | The first script `install_sys`.sh will: 20 | 1. Erase everything on the disk of your choice 21 | 2. Create partitions 22 | - Boot partition of 200M 23 | - Swap partition 24 | - Root partition 25 | 26 | The second script `install_chroot` will: 27 | 1. Set up locale / time 28 | 2. Set up Grub for the boot 29 | 30 | The third script `install_apps` will: 31 | 1. Create a new user with password 32 | 2. Install every software specified in `progs.csv` 33 | 3. Install `composer` (PHP package manager) 34 | 35 | The fourth script `install_user` will: 36 | 1. Try to install every software not found by pacman with yay (AUR repos) 37 | 2. Install my [dotfiles](https://github.com/Phantas0s/.dotfiles) 38 | 39 | ## What software are installed? 40 | 41 | Opening `apps.csv` will answer your question. 42 | 43 | ## Building Your Mouseless Development Environment 44 | 45 | Switching between a keyboard and mouse costs cognitive energy. [My book will help you set up a Linux-based development environment](https://themouseless.dev) that keeps your hands on your keyboard. Take the brain power you've been using to juggle input devices and focus it where it belongs: on the things you create. 46 | 47 | You'll learn how to write your own installation scripts too! 48 | -------------------------------------------------------------------------------- /apps.csv: -------------------------------------------------------------------------------- 1 | essential,mesa-libgl,opengl 2 | essential,xorg,X server 3 | essential,xorg-xinit,Display server boot 4 | essential,man,Manual 5 | essential,man-pages,Manual pages 6 | essential,tldr,Examples for CLIs 7 | essential,openssh,Remote login tool for SSH protocol 8 | essential,cowsay,We all need a cow in our life 9 | essential,moreutils,More utils 10 | network,networkmanager,Network manager 11 | network,nmap,Network mapper (comes with ncat too) 12 | network,wget,Tool for retrieving files using HTTP HTTPS FTP and FTPS 13 | network,net-tools,Include netstats and others 14 | network,openvpn,VPN 15 | network,lynx,CLI Browser 16 | compression,unzip,Compress / uncompress zip files 17 | compression,p7zip,Compress / uncompress 7z files 18 | audio,alsa-utils,Utils to control sound card 19 | audio,pipewire,Low level multimedia framework 20 | audio,pipewire-alsa,Sound Architecture 21 | audio,pipewire-pulse,Sound Middleware 22 | audio,pavucontrol,Control panel for input hardware 23 | audio,pulsemixer,Alternative to pavucontrol in terminal 24 | tools,rsync,Tool for transferring and synchronizing files across computer systems 25 | tools,ntfs-3g,Filesystem for phone and table 26 | tools,picom,Compositor for X - manage transparency 27 | tools,htop,Interactive process viewer 28 | tools,qtkeychain,Qt API to store passwords 29 | tools,duf,Disk analyzer 30 | tools,arandr,xrandr GUI 31 | tools,boxes,Draw ASCII boxes in terminal (AUR) 32 | tools,xsel,Manipulate the X selection 33 | tools,lxappearance,Theme switcher of LXDE 34 | tools,polkit,Control system wide privilege 35 | tools,xcape,Configure modifier key 36 | tools,bc,Calculator 37 | tools,fzf,Command line fuzzy finder 38 | tools,sysz,Use fzf to find systemd units (AUR) 39 | tools,imagemagick,Convert edit or compose images 40 | tools,unclutter,Hide the mouse after short period of time 41 | tools,pv,Display progress bar through pipeline 42 | tools,the_silver_searcher,A fast code searching tool 43 | tools,noto-fonts-cjk,Fonts for asian display 44 | tools,noto-fonts-emoji,Fonts for emojis 45 | tools,whois,Display web domain information 46 | tools,time,Measure time takes a specific command 47 | tools,downgrade,Utility to downgrade Arch packages (AUR) 48 | tools,simple-mtpfs,Can mount MTP filesystems (thanks Android) (AUR) 49 | tools,scrot,Screenshot software for i3lock 50 | tools,xclip,CLI to Clipboard 51 | tools,redshift,Adjust color of screen 52 | tools,udiskie,Automount devices 53 | tools,gparted,Partitioning tool 54 | tools,taskell,CLI kanban 55 | tools,tree,List FS in tree-like format 56 | tools,neofetch,Get system specs 57 | tools,numlockx,Keylock manager 58 | tools,xdg-ninja,Verify files which can go to xdg config (AUR) 59 | graphism,gcolor2,Simple color selector 60 | graphism,pinta,Easy to use image editor 61 | graphism,libwebp,Image converter from jpg to webp 62 | graphism,drawio-desktop,Desktop diagramming application (AUR) 63 | graphism,sxiv,Simple X image viewer 64 | graphism,gimp,Image processor 65 | graphism,gimp-plugin-gmic,Filters for gimp 66 | tmux,tmux,Terminal multiplexer 67 | tmux,tmuxp,Configure tmux session + windows + panes via config files 68 | git,git,Version control system 69 | git,diff-so-fancy,Human readable git diff 70 | i3,i3-wm,i3 window tile manager 71 | i3,i3status,i3 status bar 72 | i3,i3lock,i3 lock monitor 73 | i3,dmenu,Dynamic menu for X 74 | i3,feh,X11 image viewer 75 | i3,xdg-utils,Allow application to interact with the desktop 76 | i3,arc-gtk-theme,GTK themes 77 | gtk,gtk-theme-shades-of-gray,GTK themes (AUR) 78 | gtk,gtk-theme-arc-red,Desktop theme... but in red! (AUR) 79 | gtk,flatery-icon-theme-git,GTK icons (AUR) 80 | notify,dunst,Notification system 81 | notify,libnotify,Notifier 82 | programming,php,PHP programming language 83 | programming,phpstan,PHP static analysis tool (AUR) 84 | programming,phpmd,PHP mess detector (AUR) 85 | programming,composer,Dependency management for PHP 86 | programming,ruby,Ruby programming language 87 | programming,go,Golang programming language 88 | programming,lua,Lua programming language 89 | programming,goreleaser,Release tool for Golang (AUR) 90 | programming,golangci-lint,Fast linter for Golang (AUR) 91 | programming,go-tools,Tools for Golang 92 | programming,npm,Infamous javascript package manager 93 | programming,nvm,Change node version (AUR) 94 | programming,yarn,Wrapper for npm 95 | programming,docker,Build ship and run distributed applications 96 | programming,ctags,Generates an index file of language objects found in source files 97 | programming,yamllint,Linter for yaml 98 | programming,vint,Linter for VimScript 99 | programming,rlwrap,Intercepting user input (used for Clojure cli) 100 | programming,leiningen,REPL for Clojure 101 | programming,racket,Language Racket 102 | programming,shellcheck-bin,Linter for the shell (AUR) 103 | programming,gopls,Golang language server 104 | programming,clojure-lsp-bin,Clojure language server (AUR) 105 | programming,clj-kondo-bin,Clojure static analysis 106 | programming,lua-language-server,Lua language server 107 | programming,vscode-eslint-language-server,eslint language server (AUR) 108 | programming,sql-language-server,sql language server (AUR) 109 | programming,bash-language-server,bash language server (AUR) 110 | programming,python-lsp-server,Python language server (AUR) 111 | programming,ltex-ls-bin,Language server for grammar (AUR) 112 | sql,postgresql,Implementation of PostgreSQL 113 | sql,mariadb,Implementation of Mysql 114 | sql,mycli,Command line interface for MySQL (AUR) 115 | sql,pgcli,Command line interface for PostgreSQL (AUR) 116 | sql,litecli,Command line interface for SQLite (AUR) 117 | zsh,zsh,Unix shell (Z-Shell) 118 | neovim,neovim,Editor... and much more 119 | neovim,python-neovim,Python for neovim 120 | neovim,python2-neovim,Python2 for neovim 121 | neovim,ruby-neovim,Ruby for neovim (AUR) 122 | keyring,gnome-keyring,Gnome component to store passwords 123 | keyring,libsecret,Library for application to use gnome keyring 124 | keyring,seahorse,Gnome keyring GUI 125 | urxvt,rxvt-unicode,Terminal Urxvt 126 | urxvt,urxvt-tabbedex-mina86-git,Improved tab for Urxvt (AUR) 127 | urxvt,urxvt-resize-font-git,Increase / decrease font size for Urxvt via keystrokes(AUR) 128 | ghostty,ghostty,Terminal ghostty 129 | ghostty,ghostty-terminfo,Terminfo for ghostty 130 | ripgrep,ripgrep,Line oriented search tool (grep improved) 131 | rover,rover,Simple file browser for the terminal (AUR) 132 | nextcloud,nextcloud-client,Client to nextcloud 133 | syncthing,syncthing,Syncing files between devices 134 | hugo,hugo,Static site generator written in Go 135 | freemind,freemind,Free mind mapping software in Java 136 | joplin,joplin-desktop,Note taking app open source (AUR) 137 | language,anki,Powerful intelligent flash cards (AUR) 138 | language,translate-shell,Command line translator 139 | language,dictd,Dictionary database server 140 | videography,obs-studio,GUI for ffmpeg 141 | videography,losslesscut-bin,Simple video edition (AUR) 142 | multimedia,mpv,Free video player 143 | multimedia,lltag,Tag Manager (AUR) 144 | multimedia,ffmpeg,Complete solution to record stream audio / video 145 | multimedia,deadbeef,Clone of Foobar2000 music player 146 | office,libreoffice,Office suite 147 | office,okular,PDF reader 148 | office,zathura-pdf-mupdf,Highly customizable PDF reader 149 | office,pdfarranger,Merge PDFs 150 | office,calibre,Managing ebooks 151 | office,scribus,Document editing software 152 | newsboat,newsboat,RSS feed reader 153 | pandoc,pandoc,Document converter 154 | pandoc,lua-lpeg,Necessary library for Pandoc Lua filters 155 | pandoc,texlive-most,Tex Document Production System 156 | pandoc,texlive-most-doc,Most doc for LaTex (AUR) 157 | firefox,firefox,Browser Firefox 158 | brave,brave-bin,Browser Brave (AUR) 159 | qutebrowser,qutebrowser,Mouseless browser 160 | doublecmd,doublecmd,Graphical file manager 161 | keepass,keepassxc,Secure password management 162 | thunderbird,thunderbird,Thunderbird 163 | vmware,open-vm-tools,vmware tools 164 | vmware,xf86-video-vmware,vmware video 165 | vmware,xf86-input-vmmouse,vmware mouse 166 | gaming,lutris,Open gaming plateform 167 | gaming,steam,Video game distribution service 168 | gaming,ttf-liberation,Fonts for steam 169 | photography,darktable,RAW developer 170 | photography,digikam,Photo organizer and developer 171 | photography,breeze-icons,Icons for digikam 172 | photography,xf86-input-wacom,Drivers for Wacom tablet 173 | photography,displaycal,Display calibration software 174 | -------------------------------------------------------------------------------- /experiments.sh: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # +-----------------------------------------------------------+ 4 | # | LUCKS encryption (install_sys when formatting partitions) | 5 | # +-----------------------------------------------------------+ 6 | # 7 | # 8 | 9 | # home 10 | # mkfs.ext4 "${hd}4" 11 | # mkdir /mnt/home 12 | # mount "${hd}4" /mnt/home 13 | 14 | # Worked more or less, but I had problems when reading fstab (if I remember correctly...) 15 | 16 | # dialog --infobox "Encrypt /home partition..." 4 40 17 | 18 | # mkdir /mnt/etc/ 19 | # mkdir -m 700 /mnt/etc/luks-keys 20 | # dd if=/dev/random of=/mnt/etc/luks-keys/home bs=1 count=256 21 | # cat << EOF | cryptsetup --cipher aes-xts-plain64\ 22 | # --key-size 512\ 23 | # --hash sha512\ 24 | # --iter-time 5000\ 25 | # --use-random\ 26 | # luksFormat\ 27 | # /dev/sda4 \ 28 | # /mnt/etc/luks-keys/home 29 | # YES 30 | # EOF 31 | 32 | # cryptsetup -d /mnt/etc/luks-keys/home open /dev/sda4 home 33 | 34 | # mkfs.ext4 /dev/mapper/home 35 | # mkdir /mnt/home 36 | # mount /dev/mapper/home /mnt/home 37 | 38 | # In install_chroot 39 | 40 | # For encrypted home 41 | # sed -i -e 's/GRUB_CMDLINE_LINUX="\(.\+\)"/GRUB_CMDLINE_LINUX="\1 cryptdevice=\/dev\/sda4:crypt"/g' -e 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cryptdevice=\/dev\/sda4:crypt"/g' /etc/default/grub 42 | 43 | # To boot with encrypted home 44 | # echo "home /dev/sda4 /etc/luks-keys/home" >> /etc/crypttab 45 | # echo "/dev/mapper/home /home ext4 defaults,errors=remount-ro 0 2" >> /etc/fstab 46 | 47 | 48 | ####################### 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /install_apps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | run() { 4 | output=$(cat /var_output) 5 | 6 | log INFO "FETCH VARS FROM FILES" "$output" 7 | name=$(cat /tmp/var_user_name) 8 | url_installer=$(cat /var_url_installer) 9 | dry_run=$(cat /var_dry_run) 10 | 11 | log INFO "DOWNLOAD APPS CSV" "$output" 12 | apps_path="$(download-app-csv "$url_installer")" 13 | log INFO "APPS CSV DOWNLOADED AT: $apps_path" "$output" 14 | add-multilib-repo 15 | log INFO "MULTILIB ADDED" "$output" 16 | dialog-welcome 17 | dialog-choose-apps ch 18 | choices=$(cat ch) && rm ch 19 | log INFO "APP CHOOSEN: $choices" "$output" 20 | lines="$(extract-choosed-apps "$choices" "$apps_path")" 21 | log INFO "GENERATED LINES: $lines" "$output" 22 | apps="$(extract-app-names "$lines")" 23 | log INFO "APPS: $apps" "$output" 24 | update-system 25 | log INFO "UPDATED SYSTEM" "$output" 26 | delete-previous-aur-queue 27 | log INFO "DELETED PREVIOUS AUR QUEUE" "$output" 28 | dialog-install-apps "$apps" "$dry_run" "$output" 29 | log INFO "APPS INSTALLED" "$output" 30 | disable-horrible-beep 31 | log INFO "HORRIBLE BEEP DISABLED" "$output" 32 | set-user-permissions 33 | log INFO "USER PERMISSIONS SET" "$output" 34 | 35 | continue-install "$url_installer" "$name" 36 | } 37 | 38 | log() { 39 | local -r level=${1:?} 40 | local -r message=${2:?} 41 | local -r output=${3:?} 42 | local -r timestamp=$(date +"%Y-%m-%d %H:%M:%S") 43 | 44 | echo -e "${timestamp} [${level}] ${message}" >>"$output" 45 | } 46 | 47 | download-app-csv() { 48 | local -r url_installer=${1:?} 49 | 50 | apps_path="/tmp/apps.csv" 51 | curl "$url_installer/apps.csv" > "$apps_path" 52 | 53 | echo $apps_path 54 | } 55 | 56 | # Add multilib repo for steam 57 | add-multilib-repo() { 58 | echo "[multilib]" >> /etc/pacman.conf && echo "Include = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf 59 | } 60 | 61 | dialog-welcome() { 62 | dialog --title "Welcome!" --msgbox "Welcome to Phantas0s dotfiles and software installation script for Arch linux.\n" 10 60 63 | } 64 | 65 | dialog-choose-apps() { 66 | local file=${1:?} 67 | 68 | apps=("essential" "Essentials" on 69 | "compression" "Compression Tools" on 70 | "tools" "Very nice tools to have (highly recommended)" on 71 | "audio" "Audio tools" on 72 | "network" "Network Configuration" off 73 | "git" "Git & git tools" on 74 | "i3" "i3 Tile manager & Desktop" on 75 | "tmux" "Tmux" on 76 | "neovim" "Neovim" on 77 | "keyring" "Keyring applications" on 78 | "urxvt" "Urxvt unicode" on 79 | "zsh" "Unix Z-Shell (zsh)" on 80 | "ripgrep" "Ripgrep" on \ 81 | "qutebrowser" "Qutebrowser" on 82 | "notify" "Notifications with dunst & libnotify" on 83 | "gtk" "GTK 3 themes and icons" on 84 | "programming" "Programming environments (PHP, Ruby, Go, Docker, Clojure)" on 85 | "keepass" "Keepass" on 86 | "sql" "Mysql (mariadb) & mysql tools" on 87 | "office" "Office tools (Libreoffice...)" off 88 | "multimedia" "Multimedia" off 89 | "videography" "Video creation" off 90 | "graphism" "Design" off 91 | "photography" "Photography tools" off 92 | "firefox" "Firefox (browser)" off 93 | "brave" "brave (browser)" off 94 | "newsboat" "RSS Feed Reader" on 95 | "joplin" "Note taking system" off 96 | "thunar" "Graphical file manager" off 97 | "thunderbird" "Thunderbird" off 98 | "pandoc" "Pandoc and usefull dependencies" off 99 | "syncthing" "Sync files via P2P" off 100 | "rover" "Simple file browser for the terminal" off 101 | "language" "Language tools" off 102 | "nextcloud" "Nextcloud client" off 103 | "hugo" "Hugo static site generator" off 104 | "freemind" "Freemind - mind mapping software" off 105 | "doublecmd" "Double Commander - File explorer a la FreeCommander" off 106 | "vmware" "Vmware tools" off 107 | "gaming" "Almost everything for gaming on Linux" off) 108 | 109 | dialog --checklist "You can now choose the groups of applications you want to install, according to your own CSV file.\n\n Press SPACE to select and ENTER to validate your choices." 0 0 0 "${apps[@]}" 2> "$file" 110 | } 111 | 112 | extract-choosed-apps() { 113 | local -r choices=${1:?} 114 | local -r apps_path=${2:?} 115 | 116 | selection="^$(echo $choices | sed -e 's/ /,|^/g')," 117 | lines=$(grep -E "$selection" "$apps_path") 118 | 119 | echo "$lines" 120 | } 121 | 122 | extract-app-names() { 123 | local -r lines=${1:?} 124 | echo "$lines" | awk -F, '{print $2}' 125 | } 126 | 127 | update-system() { 128 | pacman -Syu --noconfirm 129 | } 130 | 131 | delete-previous-aur-queue() { 132 | rm -f /tmp/aur_queue 133 | } 134 | 135 | dialog-install-apps() { 136 | dialog --title "Let's go!" --msgbox \ 137 | "The system will now install everything you need.\n\n\ 138 | It will take some time.\n\n " 13 60 139 | } 140 | 141 | dialog-install-apps() { 142 | local -r final_apps=${1:?} 143 | local -r dry_run=${2:?} 144 | local -r output=${3:?} 145 | 146 | count=$(echo "$final_apps" | wc -l) 147 | 148 | c=0 149 | echo "$final_apps" | while read -r line; do 150 | c=$(( "$c" + 1 )) 151 | 152 | dialog --title "Arch Linux Installation" --infobox \ 153 | "Downloading and installing program $c out of $count: $line..." 8 70 154 | 155 | if [ "$dry_run" = false ]; then 156 | pacman-install "$line" "$output" 157 | 158 | # Needed if system installed in VMWare 159 | if [ "$line" = "open-vm-tools" ]; then 160 | systemctl enable vmtoolsd.service 161 | systemctl enable vmware-vmblock-fuse.service 162 | fi 163 | 164 | if [ "$line" = "networkmanager" ]; then 165 | # Enable the systemd service NetworkManager. 166 | systemctl enable NetworkManager.service 167 | fi 168 | 169 | if [ "$line" = "zsh" ]; then 170 | # zsh as default terminal for user 171 | chsh -s "$(which zsh)" "$name" 172 | fi 173 | 174 | if [ "$line" = "docker" ]; then 175 | groupadd docker 176 | gpasswd -a "$name" docker 177 | systemctl enable docker.service 178 | fi 179 | 180 | if [ "$line" = "at" ]; then 181 | systemctl enable atd.service 182 | fi 183 | 184 | if [ "$line" = "mariadb" ]; then 185 | mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 186 | fi 187 | else 188 | fake_install "$line" 189 | fi 190 | done 191 | } 192 | 193 | fake-install() { 194 | echo "$1 fakely installed!" >> "$output" 195 | } 196 | 197 | pacman-install() { 198 | local -r app=${1:?} 199 | local -r output=${2:?} 200 | 201 | ((pacman --noconfirm --needed -S "$app" &>> "$output") || echo "$app" &>> /tmp/aur_queue) 202 | } 203 | 204 | continue-install() { 205 | local -r url_installer=${1:?} 206 | local -r name=${2:?} 207 | 208 | curl "$url_installer/install_user.sh" > /tmp/install_user.sh; 209 | 210 | if [ "$dry_run" = false ]; then 211 | # Change user and begin the install use script 212 | sudo -u "$name" bash /tmp/install_user.sh 213 | fi 214 | } 215 | 216 | set-user-permissions() { 217 | dialog --infobox "Copy user permissions configuration (sudoers)..." 4 40 218 | curl "$url_installer/sudoers" > /etc/sudoers 219 | } 220 | 221 | disable-horrible-beep() { 222 | rmmod pcspkr 223 | echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf 224 | } 225 | 226 | run "$@" 227 | -------------------------------------------------------------------------------- /install_chroot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # e - script stops on error 4 | # u - error if undefined variable 5 | # o pipefail - script fails if command piped fails 6 | set -euo pipefail 7 | 8 | run() { 9 | output=$(cat /var_output) 10 | log INFO "FETCH VARS FROM FILES" "$output" 11 | uefi=$(cat /var_uefi) 12 | hd=$(cat /var_disk) 13 | hostname=$(cat /var_hostname) 14 | url_installer=$(cat /var_url_installer) 15 | dry_run=$(cat /var_dry_run) 16 | 17 | log INFO "INSTALL DIALOG" "$output" 18 | install-dialog 19 | 20 | log INFO "INSTALL GRUB ON $hd WITH UEFI $uefi" "$output" 21 | install-grub "$hd" "$uefi" 22 | 23 | log INFO "SET HARDWARE CLOCK" "$output" 24 | set-hardware-clock 25 | 26 | log INFO "SET TIMEZONE" "$output" 27 | # timedatectl set-timezone "Europe/Berlin" 28 | ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime 29 | hwclock --systohc 30 | 31 | log INFO "WRITE HOSTNAME: $hostname" "$output" \ 32 | write-hostname "$hostname" 33 | 34 | log INFO "CONFIGURE LOCALE" "$output" 35 | configure-locale "en_US.UTF-8" "UTF-8" 36 | 37 | log INFO "ADD ROOT" "$output" 38 | dialog --title "root password" --msgbox "It's time to add a password for the root user" 10 60 39 | config_user root 40 | 41 | log INFO "ADD USER" "$output" 42 | dialog --title "Add User" --msgbox "We can't always be root. Too many responsibilities. Let's create another user." 10 60 43 | 44 | config_user 45 | 46 | continue-install "$url_installer" 47 | } 48 | 49 | log() { 50 | local -r level=${1:?} 51 | local -r message=${2:?} 52 | local -r output=${3:?} 53 | local -r timestamp=$(date +"%Y-%m-%d %H:%M:%S") 54 | 55 | echo -e "${timestamp} [${level}] ${message}" >>"$output" 56 | } 57 | 58 | write-hostname() { 59 | local -r hostname=${1:?} 60 | echo "$hostname" > /etc/hostname 61 | } 62 | 63 | install-dialog() { 64 | pacman --noconfirm --needed -S dialog 65 | } 66 | 67 | install-grub() { 68 | local -r hd=${1:?} 69 | local -r uefi=${2:?} 70 | 71 | pacman -S --noconfirm grub 72 | 73 | if [ "$uefi" = 1 ]; then 74 | pacman -S --noconfirm efibootmgr 75 | grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi 76 | else 77 | grub-install "$hd" 78 | fi 79 | 80 | grub-mkconfig -o /boot/grub/grub.cfg 81 | } 82 | 83 | set-timezone() { 84 | local -r tz=${1:?} 85 | timedatectl set-timezone "$tz" 86 | } 87 | 88 | set-hardware-clock() { 89 | hwclock --systohc 90 | } 91 | 92 | configure-locale() { 93 | local -r locale=${1:?} 94 | local -r encoding=${2:?} 95 | 96 | echo "$locale $encoding" >> /etc/locale.gen 97 | locale-gen 98 | echo "LANG=$locale" > /etc/locale.conf 99 | } 100 | 101 | config_user() { 102 | local name=${1:-none} 103 | 104 | if [ "$name" == none ]; then 105 | dialog --no-cancel --inputbox "Please enter your username" 10 60 2> name 106 | name=$(cat name) && rm name 107 | fi 108 | 109 | dialog --no-cancel --passwordbox "Enter your password" 10 60 2> pass1 110 | dialog --no-cancel --passwordbox "Enter your password again. To be sure..." 10 60 2> pass2 111 | 112 | while [ "$(cat pass1)" != "$(cat pass2)" ] 113 | do 114 | dialog --no-cancel --passwordbox "Passwords do not match.\n\nEnter password again." 10 60 2> pass1 115 | dialog --no-cancel --passwordbox "Retype password." 10 60 2> pass2 116 | done 117 | pass1=$(cat pass1) 118 | 119 | rm pass1 pass2 120 | 121 | # Create user if doesn't exist 122 | if [[ ! "$(id -u "$name" 2> /dev/null)" ]]; then 123 | dialog --infobox "Adding user $name..." 4 50 124 | useradd -m -g wheel -s /bin/bash "$name" 125 | fi 126 | 127 | # Add password to user 128 | echo "$name:$pass1" | chpasswd 129 | 130 | # Save name for later 131 | echo "$name" > /tmp/var_user_name 132 | } 133 | 134 | continue-install() { 135 | local -r url_installer=${1:?} 136 | 137 | dialog --title "Continue installation" --yesno "Do you want to install all the softwares and the dotfiles?" 10 60 \ 138 | && curl "$url_installer/install_apps.sh" > /tmp/install_apps.sh \ 139 | && bash /tmp/install_apps.sh 140 | } 141 | 142 | run "$@" 143 | -------------------------------------------------------------------------------- /install_sys.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # e - script stops on error 4 | # u - error if undefined variable 5 | # o pipefail - script fails if command piped fails 6 | set -euo pipefail 7 | 8 | # YOU NEED TO MODIFY YOUR INSTALL URL 9 | url-installer() { 10 | echo "https://raw.githubusercontent.com/Phantas0s/ArchInstall/master" 11 | } 12 | 13 | run() { 14 | local dry_run=${dry_run:-false} 15 | local output=${output:-/dev/tty2} 16 | 17 | while getopts d:o: option 18 | do 19 | case "${option}" 20 | in 21 | d) dry_run=${OPTARG};; 22 | o) output=${OPTARG};; 23 | *);; 24 | esac 25 | done 26 | 27 | log INFO "DRY RUN? $dry_run" "$output" 28 | 29 | install-dialog 30 | dialog-are-you-sure 31 | 32 | local hostname 33 | dialog-name-of-computer hn 34 | hostname=$(cat hn) && rm hn 35 | log INFO "HOSTNAME: $hostname" "$output" 36 | 37 | local disk 38 | dialog-what-disk-to-use hd 39 | disk=$(cat hd) && rm hd 40 | log INFO "DISK CHOSEN: $disk" "$output" 41 | 42 | local swap_size 43 | dialog-what-swap-size swaps 44 | swap_size=$(cat swaps) && rm swaps 45 | log INFO "SWAP SIZE: $swap_size" "$output" 46 | 47 | log INFO "SET TIME" "$output" 48 | set-timedate 49 | 50 | local wiper 51 | dialog-how-wipe-disk "$disk" dfile 52 | wiper=$(cat dfile) && rm dfile 53 | log INFO "WIPER CHOICE: $wiper" "$output" 54 | 55 | [[ "$dry_run" = false ]] \ 56 | && log INFO "ERASE DISK" "$output" \ 57 | && erase-disk "$wiper" "$disk" 58 | 59 | [[ "$dry_run" = false ]] \ 60 | && log INFO "CREATE PARTITIONS" "$output" \ 61 | && fdisk-partition "$disk" "$(boot-partition "$(is-uefi)")" "$swap_size" 62 | 63 | [[ "$dry_run" = false ]] \ 64 | && log INFO "FORMAT PARTITIONS" "$output" \ 65 | && format-partitions "$disk" "$(is-uefi)" 66 | 67 | log INFO "CREATE VAR FILES" "$output" 68 | echo "$(is-uefi)" > /mnt/var_uefi 69 | echo "$disk" > /mnt/var_disk 70 | echo "$hostname" > /mnt/var_hostname 71 | echo "$output" > /mnt/var_output 72 | echo "$dry_run" > /mnt/var_dry_run 73 | url-installer > /mnt/var_url_installer 74 | 75 | [[ "$dry_run" = false ]] \ 76 | && log INFO "BEGIN INSTALL ARCH LINUX" "$output" \ 77 | && install-arch-linux 78 | 79 | [[ "$dry_run" = false ]] \ 80 | && log INFO "BEGIN CHROOT SCRIPT" "$output" \ 81 | && install-chroot "$(url-installer)" 82 | 83 | clean 84 | end-of-install 85 | } 86 | 87 | log() { 88 | local -r level=${1:?} 89 | local -r message=${2:?} 90 | local -r output=${3:?} 91 | local -r timestamp=$(date +"%Y-%m-%d %H:%M:%S") 92 | 93 | echo -e "${timestamp} [${level}] ${message}" >>"$output" 94 | } 95 | 96 | install-dialog() { 97 | pacman -Sy 98 | pacman --noconfirm -S dialog 99 | } 100 | 101 | dialog-are-you-sure() { 102 | dialog --defaultno \ 103 | --title "Are you sure?" \ 104 | --yesno "This is my personnal arch linux install. \n\n\ 105 | It will just DESTROY EVERYTHING on the hard disk of your choice. \n\n\ 106 | Don't say YES if you are not sure about what you're doing! \n\n\ 107 | Are you sure?" 15 60 || exit 108 | } 109 | 110 | dialog-name-of-computer() { 111 | local file=${1:?} 112 | dialog --no-cancel --inputbox "Enter a name for your computer." 10 60 2> "$file" 113 | } 114 | 115 | is-uefi() { 116 | local uefi=0 117 | ls /sys/firmware/efi/efivars &> /dev/null && uefi=1 118 | 119 | echo "$uefi" 120 | } 121 | 122 | dialog-what-disk-to-use() { 123 | local file=${1:?} 124 | 125 | devices_list=($(lsblk -d | awk '{print "/dev/" $1 " " $4 " on"}' | grep -E 'sd|hd|vd|nvme|mmcblk')) 126 | dialog --title "Choose your hard drive" --no-cancel --radiolist \ 127 | "Where do you want to install your new system?\n\n\ 128 | Select with SPACE, valid with ENTER.\n\n\ 129 | WARNING: Everything will be DESTROYED on the hard disk!" 15 60 4 "${devices_list[@]}" 2> "$file" 130 | } 131 | 132 | dialog-what-swap-size() { 133 | local default_size="8" 134 | local file=${1:?} 135 | dialog --no-cancel --inputbox "You need four partitions: Boot, Root and Swap \n\ 136 | The boot will be 512M\n\ 137 | The root will be the rest of the hard disk\n\ 138 | Enter partitionsize in gb for the Swap. \n\n\ 139 | If you dont enter anything: \n\ 140 | swap -> ${default_size}G \n\n" 20 60 2> "$file" 141 | 142 | local size=$(cat "$file") 143 | [[ $size =~ ^[0-9]+$ ]] || size=$default_size 144 | 145 | echo "$size" > "$file" 146 | } 147 | 148 | set-timedate() { 149 | timedatectl set-ntp true 150 | } 151 | 152 | dialog-how-wipe-disk() { 153 | local -r hd=${1:?} 154 | local -r file=${2:?} 155 | 156 | dialog --no-cancel \ 157 | --title "!!! DELETE EVERYTHING !!!" \ 158 | --menu "Choose the way to destroy everything on your hard disk ($hd)" 15 60 4 \ 159 | 1 "Use dd (wipe all disk)" \ 160 | 2 "Use schred (slow & secure)" \ 161 | 3 "No need - my hard disk is empty" 2> "$file" 162 | } 163 | 164 | erase-disk() { 165 | local -r choice=${1:?} 166 | local -r hd=${2:?} 167 | 168 | set +e 169 | case $choice in 170 | 1) dd if=/dev/zero of="$hd" status=progress 2>&1 | dialog --title "Formatting $hd..." --progressbox --stdout 20 60;; 171 | 2) shred -v "$hd" | dialog --title "Formatting $hd..." --progressbox --stdout 20 60;; 172 | 3) ;; 173 | esac 174 | set -e 175 | } 176 | 177 | boot-partition() { 178 | local -r uefi=${1:?} 179 | local boot_partition_type=1 180 | [[ "$uefi" == 0 ]] && local boot_partition_type=4 181 | 182 | echo "$boot_partition_type" 183 | } 184 | 185 | fdisk-partition() { 186 | local -r hd=${1:?} 187 | local -r boot_partition_type=${2:?} 188 | local -r swap_size=${3:?} 189 | 190 | partprobe "$hd" 191 | 192 | #g - create non empty GPT partition table 193 | #n - create new partition 194 | #p - primary partition 195 | #e - extended partition 196 | #w - write the table to disk and exit 197 | fdisk "$hd" < /dev/null && hd="${hd}p" 222 | 223 | mkswap "${hd}2" 224 | swapon "${hd}2" 225 | 226 | mkfs.ext4 "${hd}3" 227 | mount "${hd}3" /mnt 228 | 229 | [[ "$uefi" == 1 ]] && \ 230 | mkfs.fat -F32 "${hd}1" && \ 231 | mkdir -p /mnt/boot/efi && \ 232 | mount "${hd}"1 /mnt/boot/efi 233 | } 234 | 235 | 236 | install-arch-linux() { 237 | pacstrap /mnt base base-devel linux linux-firmware 238 | genfstab -U /mnt >> /mnt/etc/fstab 239 | } 240 | 241 | install-chroot() { 242 | local -r installer_url=${1:?} 243 | 244 | curl "$installer_url/install_chroot.sh" > /mnt/install_chroot.sh 245 | arch-chroot /mnt bash install_chroot.sh 246 | } 247 | 248 | clean() { 249 | rm /mnt/var_uefi 250 | rm /mnt/var_disk 251 | rm /mnt/var_hostname 252 | rm /mnt/var_output 253 | rm /mnt/var_dry_run 254 | } 255 | 256 | end-of-install() { 257 | dialog --title "Reboot time" \ 258 | --yesno "Congrats! The install is done! \n\nTo run the new graphical environment, you need to restart your computer. \n\nDo you want to restart now?" 20 60 259 | 260 | response=$? 261 | case $response in 262 | 0) reboot;; 263 | 1) clear;; 264 | esac 265 | 266 | clear 267 | } 268 | 269 | run "$@" 270 | -------------------------------------------------------------------------------- /install_user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | run() { 4 | output="/home/$(whoami)/install_log" 5 | cd /tmp 6 | 7 | log INFO "FETCH VARS FROM FILES" "$output" 8 | # dry_run=$(cat /var_dry_run) 9 | 10 | log INFO "CREATE DIRECTORIES" "$output" 11 | create-directories 12 | log INFO "INSTALL YAY" "$output" 13 | install-yay "$output" 14 | log INFO "INSTALL AUR APPS" "$output" 15 | install-aur-apps "$output" 16 | log INFO "INSTALL DOTFILES" "$output" 17 | install-dotfiles 18 | } 19 | 20 | log() { 21 | local -r level=${1:?} 22 | local -r message=${2:?} 23 | local -r output=${3:?} 24 | local -r timestamp=$(date +"%Y-%m-%d %H:%M:%S") 25 | 26 | echo -e "${timestamp} [${level}] ${message}" >>"$output" 27 | } 28 | 29 | create-directories() { 30 | mkdir -p /home/"$(whoami)"/{Documents,Downloads,Videos,workspace,Music,composer} 31 | 32 | command -v "go" >/dev/null && mkdir -p "/home/$(whoami)/workspace/go/bin" 33 | command -v "go" >/dev/null && mkdir -p "/home/$(whoami)/workspace/go/pkg" 34 | command -v "go" >/dev/null && mkdir -p "/home/$(whoami)/workspace/go/src" 35 | 36 | command -v "nextcloud" >/dev/null && mkdir -p "/home/$(whoami)/Nextcloud" 37 | } 38 | 39 | install-yay() { 40 | local -r output=${1:?} 41 | 42 | dialog --infobox "[$(whoami)] Installing \"yay\", an AUR helper..." 10 60 43 | aur-check "$output" yay 44 | } 45 | 46 | install-aur-apps() { 47 | local -r output=${1:?} 48 | 49 | count=$(wc -l < /tmp/aur_queue) 50 | c=0 51 | cat /tmp/aur_queue | while read -r prog 52 | do 53 | c=$(( "$c" + 1 )) 54 | dialog --infobox "[$(whoami)] AUR install - Downloading and installing program $c out of $count: $prog..." 10 60 55 | aur-check "$output" "$prog" 56 | done 57 | } 58 | 59 | #Install an AUR package manually. 60 | aur-install() { 61 | local -r app=${1:?} 62 | 63 | curl -O "https://aur.archlinux.org/cgit/aur.git/snapshot/$app.tar.gz" \ 64 | && tar -xvf "$app.tar.gz" \ 65 | && cd "$app" \ 66 | && makepkg --noconfirm -si \ 67 | && cd - \ 68 | && rm -rf "$app" "$app.tar.gz" ; 69 | } 70 | 71 | # aur_check runs on each of its arguments 72 | # if the argument is not already installed 73 | # it either uses yay to install it 74 | # or installs it manually. 75 | aur-check() { 76 | local -r output=${1:?} 77 | shift 1 78 | 79 | qm=$(pacman -Qm | awk '{print $1}') 80 | for arg in "$@" 81 | do 82 | if [[ "$qm" != *"$arg"* ]]; then 83 | yay --noconfirm -S "$arg" &>> "$output" || aur-install "$arg" &>> "$output" 84 | fi 85 | done 86 | } 87 | 88 | install-dotfiles() { 89 | DOTFILES="/home/$(whoami)/.dotfiles" 90 | if [ ! -d "$DOTFILES" ]; 91 | then 92 | dialog --infobox "[$(whoami)] Downloading .dotfiles..." 10 60 93 | git clone --recurse-submodules "https://github.com/Phantas0s/.dotfiles" "$DOTFILES" >/dev/null 94 | fi 95 | 96 | source "/home/$(whoami)/.dotfiles/zsh/zshenv" 97 | cd "$DOTFILES" 98 | command -v "zsh" >/dev/null && zsh ./install.sh -y 99 | } 100 | 101 | run "$@" 102 | -------------------------------------------------------------------------------- /screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Phantas0s/ArchInstall/f673fcd5463bd88b223dce575c55e2b3ae496e8f/screen.png -------------------------------------------------------------------------------- /screen_780.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Phantas0s/ArchInstall/f673fcd5463bd88b223dce575c55e2b3ae496e8f/screen_780.png -------------------------------------------------------------------------------- /sudoers: -------------------------------------------------------------------------------- 1 | ## sudoers file. 2 | ## 3 | ## This file MUST be edited with the 'visudo' command as root. 4 | ## Failure to use 'visudo' may result in syntax or file permission errors 5 | ## that prevent sudo from running. 6 | ## 7 | ## See the sudoers man page for the details on how to write a sudoers file. 8 | ## 9 | 10 | ## 11 | ## Host alias specification 12 | ## 13 | ## Groups of machines. These may include host names (optionally with wildcards), 14 | ## IP addresses, network numbers or netgroups. 15 | # Host_Alias WEBSERVERS = www1, www2, www3 16 | 17 | ## 18 | ## User alias specification 19 | ## 20 | ## Groups of users. These may consist of user names, uids, Unix groups, 21 | ## or netgroups. 22 | # User_Alias ADMINS = millert, dowdy, mikef 23 | 24 | ## 25 | ## Cmnd alias specification 26 | ## 27 | ## Groups of commands. Often used to group related commands together. 28 | # Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \ 29 | # /usr/bin/pkill, /usr/bin/top 30 | # Cmnd_Alias REBOOT = /sbin/halt, /sbin/reboot, /sbin/poweroff 31 | 32 | ## 33 | ## Defaults specification 34 | ## 35 | ## You may wish to keep some of the following environment variables 36 | ## when running commands via sudo. 37 | ## 38 | ## Locale settings 39 | # Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET" 40 | ## 41 | ## Run X applications through sudo; HOME is used to find the 42 | ## .Xauthority file. Note that other programs use HOME to find 43 | ## configuration files and this may lead to privilege escalation! 44 | # Defaults env_keep += "HOME" 45 | ## 46 | ## X11 resource path settings 47 | # Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH" 48 | ## 49 | ## Desktop path settings 50 | # Defaults env_keep += "QTDIR KDEDIR" 51 | ## 52 | ## Allow sudo-run commands to inherit the callers' ConsoleKit session 53 | # Defaults env_keep += "XDG_SESSION_COOKIE" 54 | ## 55 | ## Uncomment to enable special input methods. Care should be taken as 56 | ## this may allow users to subvert the command being run via sudo. 57 | # Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER" 58 | ## 59 | ## Uncomment to use a hard-coded PATH instead of the user's to find commands 60 | # Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 61 | ## 62 | ## Uncomment to send mail if the user does not enter the correct password. 63 | # Defaults mail_badpass 64 | ## 65 | ## Uncomment to enable logging of a command's output, except for 66 | ## sudoreplay and reboot. Use sudoreplay to play back logged sessions. 67 | # Defaults log_output 68 | # Defaults!/usr/bin/sudoreplay !log_output 69 | # Defaults!/usr/local/bin/sudoreplay !log_output 70 | # Defaults!REBOOT !log_output 71 | 72 | ## 73 | ## Runas alias specification 74 | ## 75 | 76 | ## 77 | ## User privilege specification 78 | ## 79 | root ALL=(ALL) ALL 80 | 81 | ## Uncomment to allow members of group wheel to execute any command 82 | # %wheel ALL=(ALL) ALL 83 | 84 | ## No need to insert sudo in different terminal again and again 85 | Defaults !tty_tickets 86 | 87 | ## Same thing without a password 88 | %wheel ALL=(ALL) NOPASSWD: ALL 89 | 90 | ## Uncomment to allow members of group sudo to execute any command 91 | # %sudo ALL=(ALL) ALL 92 | 93 | ## Uncomment to allow any user to run sudo if they know the password 94 | ## of the user they are running the command as (root by default). 95 | # Defaults targetpw # Ask for the password of the target user 96 | # ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw' 97 | 98 | ## Read drop-in files from /etc/sudoers.d 99 | ## (the '#' here does not indicate a comment) 100 | #includedir /etc/sudoers.d 101 | --------------------------------------------------------------------------------