Overhaul install script

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2020-02-02 20:20:32 +01:00
parent ce2413484c
commit b2e45c8af1
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
26 changed files with 692 additions and 407 deletions

View file

@ -1,5 +1,6 @@
stages: stages:
- Lint - Lint
Lint: Lint:
image: koalaman/shellcheck-alpine:latest image: koalaman/shellcheck-alpine:latest
stage: Lint stage: Lint
@ -17,3 +18,5 @@ Lint:
- shellcheck ./system/.config/zsh/.zshrc - shellcheck ./system/.config/zsh/.zshrc
- shellcheck ./system/.config/X11/xsetup - shellcheck ./system/.config/X11/xsetup
- shellcheck ./install - shellcheck ./install
- shellcheck ./.install/*.sh
- shellcheck ./.install/lib/*.sh

33
.install/arch.sh Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# arch.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Installs arch packages from the offical repositories
output::section "Arch Packages"
# List created using: yay -Qqen > packages.native.list
if output::prompt "Do you want to install Arch packages?"; then
output::log "Updating package database"
yay -Syy |& output::debug
output::success "Package database successfully updated"
package_count=$(< "${INSTALL_DIR}/packages/packages.native.list" wc -l)
output::log "Installing ${package_count} packages"
yay -S \
--asexplicit \
--noconfirm \
--sudoloop \
--needed \
--devel \
--nopgpfetch \
--mflags \
--skippgpcheck \
- < "${INSTALL_DIR}/packages/packages.native.list" |& output::debug
output::success "Packages successfully installed"
fi

33
.install/aur.sh Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# aur.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Installs arch packages from the AUR
output::section "AUR Packages"
# List created using: yay -Qqem > packages.aur.list
if output::prompt "Do you want to install AUR packages?"; then
output::log "Updating package database"
yay -Syy |& output::debug
output::success "Package database successfully updated"
package_count=$(< "${INSTALL_DIR}/packages/packages.aur.list" wc -l)
output::log "Installing ${package_count} packages. This may take a few hours"
yay -S \
--asexplicit \
--noconfirm \
--sudoloop \
--needed \
--devel \
--nopgpfetch \
--mflags \
--skippgpcheck \
- < "${INSTALL_DIR}/packages/packages.aur.list" |& output::debug
output::success "Packages successfully installed"
fi

23
.install/composer.sh Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# composer.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Installs global composer packages
CONFIG_COMPOSER_PACKAGES=(
"laravel/installer"
)
output::section "Composer"
if output::prompt "Do you want to install global composer packages?"; then
output::log "Installing ${#CONFIG_COMPOSER_PACKAGES[@]} packages"
output::list ${CONFIG_COMPOSER_PACKAGES[@]}
composer global require "${CONFIG_COMPOSER_PACKAGES[@]}" |& output::debug
output::success "Packages successfully installed"
fi

31
.install/directories.sh Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# directories.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Creates directories in the home directory
CONFIG_DIRECTORIES=(
".local/log"
".local/share/gnupg"
".local/share/vpn"
"dev/build"
"dev/opensource"
"dev/pkg"
"dev/projects"
"downloads"
"games"
"videos"
)
output::section "Creating directories"
for dir in "${CONFIG_DIRECTORIES[@]}"; do
output::log "Creating directory ${YELLOW}${HOME}/${dir}${DEFAULT}"
mkdir -p "${HOME}/${dir}"
done
output::success "Successfully created directories"

37
.install/etc.sh Normal file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# etc.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Copies files to /etc
declare -A CONFIG_ETC_FILES
CONFIG_ETC_FILES=(
["/etc/cron.daily/update-mirror"]="755"
["/etc/default/tlp"]="644"
["/etc/docker/daemon.json"]="644"
["/etc/gemrc"]="644"
["/etc/logrotate.d/custom.conf"]="644"
["/etc/mkinitcpio.conf"]="644"
["/etc/NetworkManager/conf.d/dns.conf"]="644"
["/etc/pacman.conf"]="644"
["/etc/resolv.conf"]="644"
["/etc/sudoers.d/severin"]="0440"
["/etc/vconsole.conf"]="644"
["/etc/X11/nvidia-xorg.conf.d/00-keyboard.conf"]="644"
["/etc/X11/nvidia-xorg.conf.d/20-displaylink.conf"]="644"
["/etc/X11/xorg.conf.d/00-keyboard.conf"]="644"
["/etc/X11/xorg.conf.d/20-displaylink.conf"]="644"
["/etc/zsh/zshenv"]="644"
)
output::section "Copying /etc files"
for file in "${!CONFIG_ETC_FILES[@]}"; do
output::log "Copying ${YELLOW}${file}${DEFAULT}"
sudo install -Dm "${CONFIG_ETC_FILES[${file}]}" "${SYSTEM_DIR}${file}" "${file}" |& output::debug
done
output::success "Successfully copied /etc files"

16
.install/fonts.sh Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# fonts.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Setups fonts
output::section "Fonts"
output::log "Prepare xorg fonts"
sudo mkfontdir /usr/share/fonts/75dpi |& output::debug
sudo mkfontdir /usr/share/fonts/100dpi |& output::debug
output::success "Successfully prepared xorg fonts"

26
.install/groups.sh Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# groups.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Adds the current user to the configured groups.
CONFIG_GROUPS=(
"docker"
"log"
"mpd"
"wheel"
"video"
)
output::section "Groups"
output::log "Current user: ${USER}"
for group in "${CONFIG_GROUPS[@]}"; do
output::log "Adding user to group ${YELLOW}${group}${DEFAULT}"
sudo gpasswd -a "${USER}" "${group}" |& output::debug
done
output::success "Successfully added user to groups"

21
.install/issue.sh Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# issue.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Creates the /etc/issue file
output::section "Issue"
output::log "Creating /etc/issue"
{
echo '\e{red}';
< "/etc/hostname" tr '[:lower:]' '[:upper:]' | figlet -f big | sed "s/\\\\/\\\\\\\/g";
echo -e "\\\r (\\\l)";
echo '\e{reset}';
} > "/tmp/issue"
sudo install "/tmp/issue" "/etc/issue" |& output::debug
output::log "Successfully created /etc/issue"

5
.install/lib/lib.sh Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
declare LIB_DIR="$(dirname "${BASH_SOURCE[0]}")"
source "${LIB_DIR}/output.sh"

55
.install/lib/output.sh Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
RESET="$(tput sgr0)"
GREEN="$(tput setaf 2)"
RED="$(tput setaf 1)"
BLUE="$(tput setaf 4)"
DEFAULT="$(tput op)"
YELLOW="$(tput setaf 3)"
BOLD="$(tput bold)"
output::log() {
echo -e "${1}" |& tee -a "${INSTALL_LOG}"
}
output::debug() {
if [ -n "${INSTALL_DEBUG}" ]; then
tee -a "${INSTALL_LOG}"
else
cat > "${INSTALL_LOG}"
fi
}
output::list() {
for element in "${@}"; do
echo -e " - ${element}"
done
}
output::success() {
echo -e " ${GREEN}${DEFAULT} ${1}" |& tee -a "${INSTALL_LOG}"
}
output::question() {
printf " ${YELLOW}${1}${DEFAULT}" |& tee -a "${INSTALL_LOG}"
}
output::error() {
echo -e " ${RED}${DEFAULT} ${1}" |& tee -a "${INSTALL_LOG}"
}
output::section() {
echo -e "\n${BOLD}-- ${1} --${RESET}" |& tee -a "${INSTALL_LOG}"
}
output::prompt() {
output::question "${1} [y/N] "
read -n 1 -r
echo ""
if [[ ${REPLY} =~ ^[yY]$ ]]; then
return 0
fi
return 1
}

15
.install/lockscreen.sh Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# lockscreen.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Sets the lockscreen image
output::section "Lockscreen"
output::log "Setting lockscreen iamge"
betterlockscreen -u "${DOTFILES}/assets/lockscreen.${HOST}.jpg" |& output::debug
output::success "Successfully set lockscreen image"

26
.install/npm.sh Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# npm.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Installs global npm packages
CONFIG_NPM_PACKAGES=(
"@vue/cli"
"eslint"
"gatsby-cli"
"npm-check-updates"
)
output::section "NPM"
if output::prompt "Do you want to install global npm packages?"; then
output::log "Installing ${#CONFIG_NPM_PACKAGES[@]} packages"
output::list ${CONFIG_NPM_PACKAGES[@]}
npm i -g "${CONFIG_NPM_PACKAGES[@]}" |& output::debug
output::success "Packages successfully installed"
fi

15
.install/ntp.sh Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# ntp.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Enables NTP
output::section "NTP"
output::log "Enabling NTP"
sudo timedatectl set-ntp true |& output::debug
output::success "Successfully enabled NTP"

View file

@ -1,52 +1,65 @@
autojump
autokey autokey
betterlockscreen-git betterlockscreen-git
cava cava
chromium-vaapi-bin chromium-vaapi-bin
chromium-widevine
citra-qt-git citra-qt-git
clonehero clonehero
cloog cloog
cutentr-git cutentr-git
displaylink displaylink
dolphin-emu-git dolphin-emu-git
dust
escrotum-git escrotum-git
evhz-git evhz-git
ferdi-bin
flips-git flips-git
g810-led-git g810-led-git
gamemode gamemode
gitflow-avh gitflow-avh
gksu gksu
godot-mono-bin
gotop-bin gotop-bin
hamsket-git
intellij-idea-ultimate-edition
isl isl
jdk-jetbrains
jstest-gtk-git jstest-gtk-git
lastpass just
kunst-git
lib32-gamemode lib32-gamemode
meli-git
melonds-git melonds-git
mesen-git
minecraft-launcher minecraft-launcher
mingw-w64-binutils
mingw-w64-crt
mingw-w64-gcc
mingw-w64-headers
mingw-w64-winpthreads
mupen64plus-qt mupen64plus-qt
nerd-fonts-fira-code
nerd-fonts-fira-mono nerd-fonts-fira-mono
nvidia-xrun-git nvidia-xrun-git
osl osl
pacaudit
paper-icon-theme paper-icon-theme
pegasus-frontend-git pegasus-frontend-git
phonon-qt4 phonon-qt4
phpstorm
plata-theme plata-theme
polybar polybar
python-gspread-git python-gspread-git
python-pefile
python2-notify
rpcs3-git rpcs3-git
sameboy-git sameboy-git
sampler
sxiv-git sxiv-git
tale-git
talk-cli-git
tealdeer tealdeer
topgrade topgrade
ttf-mac-fonts ttf-mac-fonts
ttf-ms-fonts ttf-ms-fonts
vita3k-git vita3k-git
xboxdrv vvvvvv-git
wine-tkg-staging-fsync-git
xwiimote-git xwiimote-git
xwinwrap-git xwinwrap-git
yay yay

View file

@ -3,13 +3,15 @@ acpid
adobe-source-code-pro-fonts adobe-source-code-pro-fonts
adobe-source-sans-pro-fonts adobe-source-sans-pro-fonts
alacritty alacritty
alacritty-terminfo
alsa-utils alsa-utils
anki anki
anthy
arandr arandr
autoconf autoconf
autojump
automake automake
autopep8 autopep8
base
bash bash
bash-completion bash-completion
bat bat
@ -21,11 +23,12 @@ bison
blueman blueman
bluez-utils bluez-utils
bzip2 bzip2
calibre
ccache ccache
chromaprint
clang clang
code code
composer composer
compton
coreutils coreutils
cpupower cpupower
cronie cronie
@ -60,10 +63,13 @@ gawk
gcc gcc
gcc-libs gcc-libs
gettext gettext
ghex
gimp gimp
git git
glances
glibc glibc
gnome-keyring gnome-keyring
gnuplot
go-pie go-pie
gparted gparted
gpick gpick
@ -79,17 +85,23 @@ gvfs-smb
gzip gzip
hplip hplip
httpie httpie
hyperfine
i3-gaps i3-gaps
i7z
ibus ibus
ibus-anthy ibus-anthy
inetutils inetutils
inkscape
inotify-tools inotify-tools
intellij-idea-community-edition
iproute2 iproute2
iputils iputils
java-openjfx
jdk-openjdk jdk-openjdk
jdk8-openjdk jdk8-openjdk
jfsutils jfsutils
jpegoptim jpegoptim
jq
jre-openjdk jre-openjdk
keepassxc keepassxc
kvantum-theme-adapta kvantum-theme-adapta
@ -97,6 +109,7 @@ less
lib32-giflib lib32-giflib
lib32-gst-plugins-base-libs lib32-gst-plugins-base-libs
lib32-gtk3 lib32-gtk3
lib32-libpng12
lib32-libpulse lib32-libpulse
lib32-libva lib32-libva
lib32-mesa lib32-mesa
@ -106,6 +119,7 @@ lib32-openal
lib32-v4l-utils lib32-v4l-utils
lib32-virtualgl lib32-virtualgl
lib32-vulkan-icd-loader lib32-vulkan-icd-loader
libgdiplus
libmgba libmgba
libreoffice-fresh libreoffice-fresh
libudev0-shim libudev0-shim
@ -114,6 +128,7 @@ licenses
light light
linux linux
linux-firmware linux-firmware
linuxconsole
logrotate logrotate
lsb-release lsb-release
lsd lsd
@ -122,15 +137,19 @@ lvm2
lxappearance lxappearance
lzop lzop
m4 m4
mailcap
make make
man-db man-db
man-pages man-pages
mariadb
maven maven
mdadm mdadm
mesa mesa
mesa-demos mesa-demos
meson
mgba-qt mgba-qt
min min
mono
mpc mpc
mpd mpd
mpv mpv
@ -177,11 +196,13 @@ pciutils
perl perl
perl-archive-zip perl-archive-zip
picard picard
picom
powertop powertop
procps-ng procps-ng
psmisc psmisc
pulseaudio pulseaudio
pulseaudio-alsa pulseaudio-alsa
pv
pyside2 pyside2
python-atspi python-atspi
python-black python-black
@ -194,7 +215,6 @@ python-pylint
python-pyqt5 python-pyqt5
python-pyusb python-pyusb
python-reportlab python-reportlab
python2-notify
python2-numpy python2-numpy
python2-service-identity python2-service-identity
qt-gstreamer qt-gstreamer
@ -215,6 +235,7 @@ ruby
rust-racer rust-racer
rustup rustup
s-nail s-nail
scapy
sd sd
seahorse seahorse
sed sed
@ -223,8 +244,10 @@ shellcheck
simple-scan simple-scan
slock slock
smartmontools smartmontools
splint
sqlitebrowser sqlitebrowser
steam steam
stfl
streamlink streamlink
subversion subversion
sudo sudo
@ -258,6 +281,7 @@ tokei
ttf-croscore ttf-croscore
ttf-dejavu ttf-dejavu
ttf-droid ttf-droid
ttf-fira-code
ttf-fira-mono ttf-fira-mono
ttf-fira-sans ttf-fira-sans
ttf-font-awesome ttf-font-awesome
@ -275,10 +299,12 @@ wget
which which
whois whois
winetricks winetricks
wireshark-qt
wqy-zenhei wqy-zenhei
xclip xclip
xdelta3 xdelta3
xdg-user-dirs xdg-user-dirs
xdotool
xf86-video-intel xf86-video-intel
xfsprogs xfsprogs
xorg-fonts-alias xorg-fonts-alias
@ -288,6 +314,7 @@ xorg-xbacklight
xorg-xev xorg-xev
xorg-xhost xorg-xhost
xorg-xinit xorg-xinit
xorg-xmessage
xorg-xprop xorg-xprop
xorg-xrandr xorg-xrandr
xorg-xwininfo xorg-xwininfo

24
.install/permissions.sh Normal file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# groups.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Sets permissions for folders and files
declare -A CONFIG_PERMISSIONS
CONFIG_PERMISSIONS=(
["${XDG_BIN_HOME}"]="744"
)
output::section "Permissions"
for permission in "${!CONFIG_PERMISSIONS[@]}"; do
output::log "Changing owner of ${YELLOW}${permission}${DEFAULT} to ${YELLOW}${USER}${DEFAULT}"
sudo chown -R "${USER}" "${permission}" |& output::debug
output::log "Changing permission of ${YELLOW}${permission}${DEFAULT} to ${YELLOW}${CONFIG_PERMISSIONS[${permission}]}${DEFAULT}"
sudo chmod -R "${CONFIG_PERMISSIONS[${permission}]}" "${permission}" |& output::debug
done
output::success "Successfully set permissions"

32
.install/prerequisites.sh Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# prerequisites.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Installs the prerequisites for the installation script.
output::section "Prerequisites"
output::log "Installing requirements for install script"
sudo pacman -S sudo ccache git base-devel --noconfirm --needed |& output::debug
output::success "Requirements successfully installed"
is_yay_installed=$(command -v yay)
output::log "Installing yay"
if [ -z "${is_yay_installed}" ]; then
TMP_DIR=$(mktemp -d)
git clone https://aur.archlinux.org/yay.git "${TMP_DIR}" |& output::debug
(
cd "${TMP_DIR}"|| exit
makepkg -si --noconfirm --skippgpcheck |& output::debug
)
output::success "yay installed"
else
output::success "Yay is already installed"
fi

21
.install/ruby.sh Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# ruby.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Installs ruby gems
CONFIG_RUBY_GEMS=()
output::section "Ruby"
if output::prompt "Do you want to install ruby gems?"; then
output::log "Installing ${#CONFIG_RUBY_GEMS[@]} gems"
output::list ${CONFIG_RUBY_GEMS[@]}
gem install "${CONFIG_RUBY_GEMS[@]}" |& output::debug
output::success "Gems successfully installed"
fi

31
.install/rust.sh Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# rust.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Install a Rust toolchain and components using Rustup
CONFIG_RUST_CHANNEL="beta"
CONFIG_RUST_COMPONENTS=(
"clippy"
"rls"
"rustfmt"
)
output::section "Rust"
if output::prompt "Do you want to install a Rust toolchain?"; then
output::log "Installing Rust using ${CONFIG_RUST_CHANNEL} channel"
rustup -q toolchain install "${CONFIG_RUST_CHANNEL}" |& output::debug
rustup -q default "${CONFIG_RUST_CHANNEL}" |& output::debug
output::success "Rust toolchain was installed and activated"
output::log "Installing components for Rust"
output::list ${CONFIG_RUST_COMPONENTS[@]}
rustup -q component add "${CONFIG_RUST_COMPONENTS[@]}" |& output::debug
output::success "Rust components were successfully installed"
fi

15
.install/shell.sh Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# shell.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Sets default shell
output::section "Shell"
output::log "Setting default shell to zsh"
chsh -s "/bin/zsh"
output::success "Successfully set default shell to zsh"

81
.install/symlinks.sh Normal file
View file

@ -0,0 +1,81 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# symlinks.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Creates symlinks
CONFIG_LINKED_FILES_HOME=(
".config/alacritty"
".config/autokey"
".config/bat"
".config/ccache"
".config/cmus"
".config/compton"
".config/cron"
".config/custom"
".config/chromium-flags.conf"
".config/dconf"
".config/dunst"
".config/git"
".config/gtk-2.0"
".config/gtk-3.0"
".config/httpie"
".config/i3"
".config/maven"
".config/mpd"
".config/mpv"
".config/MusicBrainz"
".config/ncmpcpp"
".config/npm"
".config/octave"
".config/pacman"
".config/phpstorm"
".config/polybar"
".config/python"
".config/redshift"
".config/sqlite3"
".config/streamlink"
".config/ssh"
".config/sxhkd"
".config/topgrade.toml"
".config/Trolltech.conf"
".config/user-dirs.dirs"
".config/user-dirs.locale"
".config/vim"
".config/vue"
".config/wget"
".config/X11"
".config/yay"
".config/zathura"
".config/zsh"
".local/bin"
".local/share/gnupg/gpg-agent.conf"
)
declare -A CONFIG_LINKED_FILES
CONFIG_LINKED_FILES=(
["${HOME}/.PhpStorm2019.1"]="${XDG_CONFIG_HOME}/phpstorm"
["${HOME}/.PhpStorm2019.2"]="${XDG_CONFIG_HOME}/phpstorm"
["${HOME}/documents"]="${HOME}/data/Documents"
["${HOME}/music"]="${HOME}/data/Media/Music"
["${HOME}/pictures"]="${HOME}/data/Media/Pictures"
)
output::section "Symlinks"
for file in "${CONFIG_LINKED_FILES_HOME[@]}"; do
output::log "Linking ${YELLOW}\${HOME}/${file}${DEFAULT} to ${YELLOW}\${SYSTEM_DIR}/${file}${DEFAULT}"
rm -rf "${HOME:?}/${file}" |& output::debug
ln -fs "${SYSTEM_DIR}/${file}" "${HOME}/${file}" |& output::debug
done
for file in "${!CONFIG_LINKED_FILES[@]}"; do
output::log "Linking ${YELLOW}${file}${DEFAULT} to ${YELLOW}${CONFIG_LINKED_FILES[${file}]}${DEFAULT}"
rm -rf "${file}" |& output::debug
ln -fs "${CONFIG_LINKED_FILES[${file}]}" "${file}" |& output::debug
done
output::success "Successfully created symlinks"

45
.install/systemd.sh Normal file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# systemd.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Copies custom systemd services and enables needed services.
CONFIG_SYSTEMD_SERVICES=(
"acpid"
"bluetooth"
"cronie"
"docker"
"NetworkManager"
"org.cups.cupsd"
"suspend"
"systemd-timesyncd"
)
CONFIG_SYSTEMD_USER_SERVICES=(
"mpd"
)
output::section "Copying systemd services"
for service in "${SYSTEM_DIR}/etc/systemd/system/"*; do
output::log "Copying service ${YELLOW}$(basename "${service}")${DEFAULT}"
sudo install -m 644 "${service}" "/etc/systemd/system" |& output::debug
done
output::success "Successfully copied systemd services"
output::section "Enabling systemd services"
for service in "${CONFIG_SYSTEMD_SERVICES[@]}"; do
output::log "Enabling service ${YELLOW}${service}${DEFAULT}"
sudo systemctl enable "${service}" |& output::debug
done
for service in "${CONFIG_SYSTEMD_USER_SERVICES[@]}"; do
output::log "Enabling service ${YELLOW}${service}${DEFAULT}"
systemctl --user enable "${service}" |& output::debug
done
output::success "Successfully enabled systemd services"

21
.install/udev.sh Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# udev.sh
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# Copying custom udev rules
output::section "Copying custom udev rules"
for file in "${SYSTEM_DIR}/etc/udev/rules.d/"*.rules; do
output::log "Copying ${YELLOW}$(basename "${file}")${DEFAULT} to ${YELLOW}/etc/udev/rules.d/${DEFAULT}"
sudo cp "${file}" "/etc/udev/rules.d/" |& output::debug
done
output::log "Reload rules"
sudo udevadm control --reload-rules |& output::debug
output::success "Successfully copied udev rules"

418
install
View file

@ -13,169 +13,22 @@
# #
# USAGE: # USAGE:
# ./install # ./install
. ./system/.config/custom/env declare DOT_DIR="$(dirname "${BASH_SOURCE[0]}" | cd | pwd)"
. ./system/.local/bin/utils declare INSTALL_DIR="${DOT_DIR}/.install"
declare SYSTEM_DIR="${DOT_DIR}/system"
INSTALL_LOG="${XDG_LOG_HOME}/install.log"
source "${INSTALL_DIR}/lib/lib.sh"
#. ./system/.config/custom/env
#. ./system/.local/bin/utils
############################################################################### ###############################################################################
# Configuration variables # # Configuration variables #
############################################################################### ###############################################################################
HOST="$(hostname)" HOST="$(hostname)"
# Directories which should be created
DIRECTORIES=(
".local/log"
".local/share/gnupg"
".local/share/vpn"
"dev/build"
"dev/opensource"
"dev/pkg"
"dev/projects"
"downloads"
"games"
"videos"
)
# Files which should be symlinked in the home folder
LINKED_FILES_HOME=(
".config/alacritty"
".config/autokey"
".config/bat"
".config/ccache"
".config/cmus"
".config/compton"
".config/cron"
".config/custom"
".config/chromium-flags.conf"
".config/dconf"
".config/dunst"
".config/git"
".config/gtk-2.0"
".config/gtk-3.0"
".config/httpie"
".config/i3"
".config/maven"
".config/mpd"
".config/mpv"
".config/MusicBrainz"
".config/ncmpcpp"
".config/npm"
".config/octave"
".config/pacman"
".config/phpstorm"
".config/polybar"
".config/python"
".config/redshift"
".config/sqlite3"
".config/streamlink"
".config/ssh"
".config/sxhkd"
".config/topgrade.toml"
".config/Trolltech.conf"
".config/user-dirs.dirs"
".config/user-dirs.locale"
".config/vim"
".config/vue"
".config/wget"
".config/X11"
".config/yay"
".config/zathura"
".config/zsh"
".local/bin"
".local/share/gnupg/gpg-agent.conf"
)
# Symlinks which will be created
declare -A LINKED_FILES
LINKED_FILES=(
["${HOME}/.PhpStorm2019.1"]="${XDG_CONFIG_HOME}/phpstorm"
["${HOME}/.PhpStorm2019.2"]="${XDG_CONFIG_HOME}/phpstorm"
["${HOME}/documents"]="${HOME}/data/Documents"
["${HOME}/music"]="${HOME}/data/Media/Music"
["${HOME}/pictures"]="${HOME}/data/Media/Pictures"
)
# Permissions to set for folders and files
declare -A PERMISSIONS
PERMISSIONS=(
["${XDG_BIN_HOME}"]="744"
)
# Groups the user should be added to
ADD_GROUPS=(
"docker"
"log"
"mpd"
"wheel"
"video"
)
# Array of systemd services which should be enabled
SYSTEMD_SERVICES=(
"acpid"
"bluetooth"
"cronie"
"docker"
"NetworkManager"
"org.cups.cupsd"
"suspend"
"systemd-timesyncd"
"tlp"
"tlp-sleep"
"xboxdrv"
)
SYSTEMD_USER_SERVICES=(
"mpd"
)
# Rust components which should be installed
RUST_COMPONENTS=(
"clippy"
"rls"
"rustfmt"
)
# npm packages which should be installed globally
NPM_PACKAGES=(
"@vue/cli"
"eslint"
"gatsby-cli"
"mtgaup"
"npm-check-updates"
)
# Ruby gems which should be installed
RUBY_GEMS=(
"docker-sync"
)
# composer packages which should be installed globally
COMPOSER_PACKAGES=(
"laravel/installer"
)
# Root files which should be copied
declare -A COPY_ROOT_FILES
COPY_ROOT_FILES=(
["/etc/cron.daily/update-mirror"]="755"
["/etc/default/tlp"]="644"
["/etc/docker/daemon.json"]="644"
["/etc/gemrc"]="644"
["/etc/logrotate.d/custom.conf"]="644"
["/etc/mkinitcpio.conf"]="644"
["/etc/NetworkManager/conf.d/dns.conf"]="644"
["/etc/pacman.conf"]="644"
["/etc/resolv.conf"]="644"
["/etc/sudoers.d/severin"]="0440"
["/etc/vconsole.conf"]="644"
["/etc/X11/nvidia-xorg.conf.d/00-keyboard.conf"]="644"
["/etc/X11/nvidia-xorg.conf.d/20-displaylink.conf"]="644"
["/etc/X11/xorg.conf.d/00-keyboard.conf"]="644"
["/etc/X11/xorg.conf.d/20-displaylink.conf"]="644"
["/etc/zsh/zshenv"]="644"
)
############################################################################### ###############################################################################
# Installtion information # # Installtion information #
############################################################################### ###############################################################################
@ -184,241 +37,34 @@ echo " • The user severin is added to the sudoers file"
echo " • The multilib repository is uncommented in /etc/pacman.conf" echo " • The multilib repository is uncommented in /etc/pacman.conf"
echo -e " • Your SSH keys are located in ~/.ssh${RESET}\n" echo -e " • Your SSH keys are located in ~/.ssh${RESET}\n"
if ! ask_prompt "Are you ready to continue?"; then if ! output::prompt "Are you ready to continue?"; then
exit 1 exit 1
fi fi
source "${INSTALL_DIR}/prerequisites.sh"
############################################################################### sudo printf ""
# Work specific settings #
###############################################################################
if [ "${IS_WORK}" = "1" ]; then
export GIT_SSH_COMMAND="ssh -i /home/severin/.ssh/severin_id_rsa"
fi
source "${INSTALL_DIR}/arch.sh"
source "${INSTALL_DIR}/rust.sh"
source "${INSTALL_DIR}/aur.sh"
source "${INSTALL_DIR}/npm.sh"
source "${INSTALL_DIR}/composer.sh"
source "${INSTALL_DIR}/ruby.sh"
source "${INSTALL_DIR}/directories.sh"
source "${INSTALL_DIR}/symlinks.sh"
source "${INSTALL_DIR}/permissions.sh"
source "${INSTALL_DIR}/groups.sh"
source "${INSTALL_DIR}/systemd.sh"
source "${INSTALL_DIR}/udev.sh"
source "${INSTALL_DIR}/etc.sh"
source "${INSTALL_DIR}/ntp.sh"
source "${INSTALL_DIR}/lockscreen.sh"
source "${INSTALL_DIR}/issue.sh"
source "${INSTALL_DIR}/fonts.sh"
source "${INSTALL_DIR}/shell.sh"
############################################################################### output::section "Post installation information"
# Install package manager and packages #
###############################################################################
#print_section "Installing package requirements"
# sudo pacman -S sudo ccache git base-devel --noconfirm --needed
# print_section "Installing yay"
# is_yay_installed=$(command -v yay)
# # Install yay if not already installed
# if [ -z "${is_yay_installed}" ]; then
# git clone https://aur.archlinux.org/yay.git
# (
# cd yay || exit
# makepkg -si --noconfirm --skippgpcheck
# )
# rm -rf yay
# else
# print_log "yay is already installed"
# fi
# List created using: yay -Qqen > packages.native.list
package_count=$(< "${PACKAGES_DIR}/packages.native.list" wc -l)
if ask_prompt "Do you want to install ${package_count} Arch packages?"; then
print_log "Installing ${package_count} Arch packages"
yay -Syy > /dev/null 2>&1
yay -S --asexplicit --noconfirm --sudoloop --needed --devel --nopgpfetch --mflags --skippgpcheck - < "${PACKAGES_DIR}/packages.native.list"
fi
if ask_prompt "Do you want to install a rust toolchain?"; then
rustup toolchain install beta
rustup default beta
rustup component add "${RUST_COMPONENTS[@]}"
rustup default beta
fi
# List created using: yay -Qqem > packages.aur.list
package_count=$(< "${PACKAGES_DIR}/packages.aur.list" wc -l)
if ask_prompt "Do you want to install ${package_count} AUR packages?"; then
print_log "Installing ${package_count} AUR packages"
yay -Syy > /dev/null 2>&1
yay -S --asexplicit --noconfirm --sudoloop --needed --devel --nopgpfetch --mflags --skippgpcheck - < "${PACKAGES_DIR}/packages.aur.list"
fi
# Remove unneeded packages
#if ask_prompt "Do you want to remove all unneeded packages?"; then
# yay -Rsnu $(comm -23 <(pacman -Qqtt | sort) <(cat "${PACKAGES_DIR}/packages.native.list" "${PACKAGES_DIR}/packages.aur.list" | sort))
#fi
if ask_prompt "Do you want to install ${#NPM_PACKAGES[@]} global npm packages?"; then
print_log "Installing ${#NPM_PACKAGES[@]} packages"
npm i -g "${NPM_PACKAGES[@]}"
fi
if ask_prompt "Do you want to install ${#COMPOSER_PACKAGES[@]} global composer packages?"; then
print_log "Installing ${#COMPOSER_PACKAGES[@]} packages"
composer global require "${COMPOSER_PACKAGES[@]}"
fi
if ask_prompt "Do you want to install ${#RUBY_GEMS[@]} ruby gems?"; then
print_log "Installing ${#RUBY_GEMS[@]} gems"
gem install "${RUBY_GEMS[@]}"
fi
###############################################################################
# Creating directories #
###############################################################################
print_section "Creating directories"
for dir in "${DIRECTORIES[@]}"
do
print_log "Creating directory ${YELLOW}${HOME}/${dir}${DEFAULT}"
mkdir -p "${HOME}/${dir}"
done
###############################################################################
# Prepare work tools #
###############################################################################
print_section "Prepare work tools"
###############################################################################
# Creating symlinks #
###############################################################################
print_section "Creating symlinks"
for file in "${LINKED_FILES_HOME[@]}";
do
print_log "Linking ${YELLOW}${HOME}/${file}${DEFAULT} to ${YELLOW}${SYSTEM_DIR}/${file}${DEFAULT}"
rm -rf "${HOME:?}/${file}"
ln -fs "${SYSTEM_DIR}/${file}" "${HOME}/${file}"
done
for file in "${!LINKED_FILES[@]}"; do
print_log "Linking ${YELLOW}${file}${DEFAULT} to ${YELLOW}${LINKED_FILES[${file}]}${DEFAULT}"
rm -rf "${file}"
ln -fs "${LINKED_FILES[${file}]}" "${file}"
done
###############################################################################
# Giving permissions #
###############################################################################
print_section "Giving permissions"
for permission in "${!PERMISSIONS[@]}"; do
print_log "Changing owner of ${YELLOW}${permission}${DEFAULT} to ${YELLOW}${USER}${DEFAULT}"
sudo chown -R "${USER}" "${permission}"
print_log "Changing permission of ${YELLOW}${permission}${DEFAULT} to ${YELLOW}${PERMISSIONS[${permission}]}${DEFAULT}"
sudo chmod -R "${PERMISSIONS[${permission}]}" "${permission}"
done
###############################################################################
# Adding user to groups #
###############################################################################
print_section "Adding user to groups"
for group in "${ADD_GROUPS[@]}"
do
print_log "Adding user ${YELLOW}${USER}${DEFAULT} to group ${YELLOW}${group}${DEFAULT}"
sudo gpasswd -a "${USER}" "${group}" > /dev/null 2>&1
done
###############################################################################
# Copying systemd services #
###############################################################################
print_section "Copying systemd services"
for file in "${SYSTEM_DIR}/etc/systemd/system/"*
do
print_log "Copying ${YELLOW}$(basename "${file}")${DEFAULT} to ${YELLOW}/etc/systemd/system${DEFAULT}"
sudo install -m 644 "${file}" "/etc/systemd/system"
done
###############################################################################
# Enabling systemd services #
###############################################################################
print_section "Enabling systemd services"
for service in "${SYSTEMD_SERVICES[@]}"
do
print_log "Enabling service ${YELLOW}${service}${DEFAULT}"
sudo systemctl enable "${service}"
done
for service in "${SYSTEMD_USER_SERVICES[@]}"
do
print_log "Enabling service ${YELLOW}${service}${DEFAULT}"
systemctl --user enable "${service}"
done
###############################################################################
# Enabling systemd services #
###############################################################################
print_section "Copying custom udev rules"
for file in "${SYSTEM_DIR}/etc/udev/rules.d/"*.rules
do
print_log "Copying ${YELLOW}$(basename "${file}")${DEFAULT} to ${YELLOW}/etc/udev/rules.d/${DEFAULT}"
sudo cp "${file}" "/etc/udev/rules.d/"
done
sudo udevadm control --reload-rules
###############################################################################
# Copying root files #
###############################################################################
print_section "Copying root files"
for file in "${!COPY_ROOT_FILES[@]}"; do
print_log "Copying ${YELLOW}${file}${DEFAULT}"
sudo install -Dm "${COPY_ROOT_FILES[${file}]}" "${SYSTEM_DIR}${file}" "${file}"
done
###############################################################################
# Enable ntp #
###############################################################################
print_section "Enabling ntp"
sudo timedatectl set-ntp true
###############################################################################
# Setting lockscreen image #
###############################################################################
print_section "Setting lockscreen image"
betterlockscreen -u "${DOTFILES}/assets/lockscreen.${HOST}.jpg" > /dev/null 2>&1
print_log "Lockscreen generated"
###############################################################################
# Creating issue file #
###############################################################################
print_section "Creating issue file"
{
echo '\e{red}';
< "/etc/hostname" tr '[:lower:]' '[:upper:]' | figlet -f big | sed "s/\\\\/\\\\\\\/g";
echo -e "\\\r (\\\l)";
echo '\e{reset}';
} > "/tmp/issue"
sudo install "/tmp/issue" "/etc/issue"
print_log "Issue file created"
###############################################################################
# Fonts #
###############################################################################
print_section "Fonts"
sudo mkfontdir /usr/share/fonts/75dpi
sudo mkfontdir /usr/share/fonts/100dpi
print_log "Prepare xorg fonts"
###############################################################################
# Set default shell #
###############################################################################
print_section "Set default shell"
chsh -s "/bin/zsh"
print_log "Set default shell to zsh"
###############################################################################
# Post installation information #
###############################################################################
print_section "Post installation information"
echo "${BOLD}Make sure you do the following after this installation:" echo "${BOLD}Make sure you do the following after this installation:"
echo " • Download settings for Visual Studio Code" echo " • Download settings for Visual Studio Code"
echo " • Reboot the system" echo " • Reboot the system"

View file

@ -57,13 +57,3 @@ function print_log() {
echo -e " ${BLUE}->${DEFAULT} ${1}" echo -e " ${BLUE}->${DEFAULT} ${1}"
} }
function ask_prompt() {
read -p "${BOLD}${BLUE}::${DEFAULT} ${1} [y/N] ${RESET}" -n 1 -r
echo ""
if [[ ${REPLY} =~ ^[^yY]$ ]]; then
return 1
fi
return 0
}