2019-09-30 13:44:02 +02:00
|
|
|
#!/bin/bash
|
2020-05-02 14:40:28 +02:00
|
|
|
# @author Kevin Veen-Birkenbach
|
2019-10-01 12:30:27 +02:00
|
|
|
# shellcheck source=/dev/null # Deactivate SC1090
|
2020-05-02 13:15:15 +02:00
|
|
|
|
2020-05-02 12:37:26 +02:00
|
|
|
source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1)
|
2020-04-16 19:27:14 +02:00
|
|
|
SYSTEM_MEMORY_KB="$(grep MemTotal /proc/meminfo | awk '{print $2}')"
|
2020-05-02 12:37:26 +02:00
|
|
|
info "Start setup of customized core software..."
|
2020-05-03 18:47:21 +02:00
|
|
|
|
|
|
|
info "Copying templates to home folder..." &&
|
2020-05-02 13:15:15 +02:00
|
|
|
cp -rfv "$TEMPLATE_PATH/." "$HOME" || error "Copy templates failed."
|
2020-05-03 18:47:21 +02:00
|
|
|
|
|
|
|
info "Update packages..." &&
|
2020-05-02 13:15:15 +02:00
|
|
|
sudo pacman -Syyu || error "Package syncronisation failed."
|
2020-05-03 18:47:21 +02:00
|
|
|
|
|
|
|
info "Synchronizing pacman packages..." &&
|
2020-05-03 21:11:08 +02:00
|
|
|
get_packages "general" "client/pacman/general" "client/pacman/games" | sudo pacman -S --needed - &&
|
2020-05-03 18:47:21 +02:00
|
|
|
info "Synchronizing yay packages..." &&
|
2020-05-03 21:11:08 +02:00
|
|
|
get_packages "client/yay/general" | yay -S - || error "Syncronisation failed."
|
2020-05-03 18:47:21 +02:00
|
|
|
|
2019-10-30 10:29:26 +01:00
|
|
|
FSTAB_SWAP_ENTRY="/swapfile none swap defaults 0 0"
|
|
|
|
SWAP_FILE="/swapfile"
|
|
|
|
FSTAB_FILE="/etc/fstab"
|
|
|
|
if grep -q "$FSTAB_SWAP_ENTRY" "$FSTAB_FILE"; then
|
2020-05-02 13:28:03 +02:00
|
|
|
info "Skipping creation of swap partion because entry allready exists in \"$FSTAB_FILE\"!"
|
2019-10-30 10:29:26 +01:00
|
|
|
else
|
2020-05-03 18:47:21 +02:00
|
|
|
info "Creating swap partition..." &&
|
|
|
|
sudo fallocate -l 16G "$SWAP_FILE" &&
|
|
|
|
sudo chmod 600 "$SWAP_FILE" &&
|
|
|
|
sudo mkswap "$SWAP_FILE" &&
|
|
|
|
sudo swapon "$SWAP_FILE" &&
|
|
|
|
sudo sh -c "echo \"$FSTAB_SWAP_ENTRY\">>\"$FSTAB_FILE\"" || error "Creation of swap partition failed."
|
2019-10-30 10:29:26 +01:00
|
|
|
fi
|
2020-05-03 18:47:21 +02:00
|
|
|
|
2020-05-02 13:28:03 +02:00
|
|
|
info "Setup SSH key..."
|
2019-09-30 16:13:26 +02:00
|
|
|
ssh_key_path="$HOME/.ssh/id_rsa"
|
|
|
|
if [ ! -f "$ssh_key_path" ]; then
|
2020-05-02 13:28:03 +02:00
|
|
|
info "SSH key $ssh_key_path doesn't exists!"
|
2019-09-30 16:13:26 +02:00
|
|
|
if [ ! -f "./data$ssh_key_path" ]; then
|
2020-05-03 18:47:21 +02:00
|
|
|
info "Importing ssh key by copying data..." &&
|
|
|
|
bash "$SCRIPT_PATH""/data/export-to-system.sh" || error "Copying failed."
|
2019-09-30 16:13:26 +02:00
|
|
|
else
|
2020-05-03 18:47:21 +02:00
|
|
|
info "Generating ssh key..." &&
|
|
|
|
ssh-keygen -t rsa -b 4096 -C "$USER@$HOSTNAME" || error "Key generation failed."
|
2019-09-30 16:13:26 +02:00
|
|
|
fi
|
|
|
|
fi
|
2020-05-03 20:04:14 +02:00
|
|
|
|
|
|
|
info "Installing nonfree drivers..." &&
|
|
|
|
sudo mhwd -a pci nonfree 0300 || error "Failed."
|
|
|
|
|
|
|
|
info "Setup, configuration and installation of dependencies for installed software..."
|
|
|
|
|
|
|
|
if pacman -Qi "arduino" > /dev/null ; then
|
|
|
|
info "Configurate system for arduino..." &&
|
|
|
|
sudo usermod -a -G uucp "$USER" &&
|
|
|
|
sudo usermod -a -G lock "$USER" || error "Couldn't add \"$USER\" to the relevant groups."
|
|
|
|
fi
|
|
|
|
|
|
|
|
if pacman -Qi "atom" > /dev/null ; then
|
|
|
|
info "Installing atom packages..." &&
|
2020-05-03 21:11:08 +02:00
|
|
|
get_packages "client/apm/general" | apm install --verbose -c - &&
|
2020-05-03 20:04:14 +02:00
|
|
|
info "Installing software which is required by atom..." &&
|
|
|
|
sudo npm i -g bash-language-server &&
|
|
|
|
python -m pip install 'python-language-server[all]' || error "Failed."
|
2019-11-21 15:16:46 +01:00
|
|
|
fi
|
2020-05-03 18:47:21 +02:00
|
|
|
|
2020-05-03 20:04:14 +02:00
|
|
|
if pacman -Qi "docker" > /dev/null ; then
|
|
|
|
info "Setting up docker..." &&
|
|
|
|
info "Add current user \"$USER\" to user group docker..." &&
|
|
|
|
sudo usermod -a -G docker "$USER" &&
|
|
|
|
info "Enable docker service..." &&
|
|
|
|
sudo systemctl enable docker --now || error "Failed."
|
2020-04-16 19:27:14 +02:00
|
|
|
fi
|
2020-05-02 14:27:57 +02:00
|
|
|
|
2020-05-03 20:04:14 +02:00
|
|
|
if pacman -Qi "docker" > /dev/null ; then
|
|
|
|
info "Setting up virtualbox..." &&
|
|
|
|
pamac install virtualbox $(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-virtualbox-host-modules"}' ORS=' ') &&
|
|
|
|
sudo vboxreload &&
|
|
|
|
pamac build virtualbox-ext-oracle &&
|
|
|
|
sudo gpasswd -a "$USER" vboxusers || error "Failed."
|
|
|
|
info "Keep in mind to install the guest additions in the virtualized system. See https://wiki.manjaro.org/index.php?title=VirtualBox"
|
2019-12-16 21:38:31 +01:00
|
|
|
fi
|
2020-05-03 20:04:14 +02:00
|
|
|
|
2019-12-16 21:38:31 +01:00
|
|
|
if [ "$XDG_SESSION_TYPE" == "x11" ]; then
|
2020-05-03 20:04:14 +02:00
|
|
|
info "Synchronizing xserver tools..." &&
|
|
|
|
sudo pacman --needed -S xbindkeys &&
|
|
|
|
info "Setting up key bindings..." &&
|
|
|
|
echo "" >> "$HOME/.xbindkeysrc" &&
|
|
|
|
echo "\"gnome-terminal -e '/bin/bash $SCRIPT_PATH/import-data-from-system.sh'\"" >> "$HOME/.xbindkeysrc" &&
|
|
|
|
echo " control+alt+s" >> "$HOME/.xbindkeysrc" &&
|
|
|
|
xbindkeys --poll-rc || error "Failed."
|
2019-12-16 21:38:31 +01:00
|
|
|
fi
|
2020-05-03 20:04:14 +02:00
|
|
|
|
2019-12-16 21:38:31 +01:00
|
|
|
if [ "$DESKTOP_SESSION" == "gnome" ]; then
|
2020-05-03 20:04:14 +02:00
|
|
|
info "Synchronizing gnome tools..." &&
|
|
|
|
sudo pacman --needed -S gnome-shell-extensions gnome-terminal &&
|
|
|
|
info "Setting up gnome dash favourites..." &&
|
2019-12-16 21:38:31 +01:00
|
|
|
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop',
|
|
|
|
'org.gnome.Terminal.desktop',
|
|
|
|
'org.keepassxc.KeePassXC.desktop',
|
|
|
|
'firefox.desktop',
|
|
|
|
'chromium.desktop',
|
|
|
|
'atom.desktop',
|
|
|
|
'arduino.desktop',
|
|
|
|
'eclipse.desktop',
|
|
|
|
'vlc.desktop',
|
|
|
|
'gimp.desktop',
|
|
|
|
'blender.desktop',
|
|
|
|
'rhythmbox.desktop',
|
2020-05-03 20:04:14 +02:00
|
|
|
'org.gnome.Screenshot.desktop']" &&
|
|
|
|
info "Install GNOME extensions..." &&
|
|
|
|
info "Install \"NASA picture of the day\"..." &&
|
|
|
|
git clone https://github.com/Elinvention/gnome-shell-extension-nasa-apod.git "$HOME/.local/share/gnome-shell/extensions/nasa_apod@elinvention.ovh" &&
|
|
|
|
gnome-extensions enable nasa_apod@elinvention.ovh &&
|
|
|
|
info "Install \"Open Weather\"..." &&
|
|
|
|
git clone https://gitlab.com/jenslody/gnome-shell-extension-openweather "$HOME/.local/share/gnome-shell/extensions/openweather-extension@jenslody.de" &&
|
|
|
|
gnome-extensions enable openweather-extension@jenslody.de &&
|
|
|
|
info "Install \"Dash to Panel\"..." &&
|
|
|
|
git clone https://github.com/home-sweet-gnome/dash-to-panel "$HOME/.local/share/gnome-shell/extensions/openweather-extension@dash-to-panel@jderose9.github.com" &&
|
|
|
|
gnome-extensions enable dash-to-panel@jderose9.github.com &&
|
|
|
|
info "Deaktivating \"Dash to Dock\"" &&
|
|
|
|
gnome-extensions disable dash-to-dock@micxgx.gmail.com || error "Failed."
|
2019-12-16 21:38:31 +01:00
|
|
|
fi
|
2020-05-03 20:04:14 +02:00
|
|
|
|
|
|
|
info "Removing all software from user startup..." &&
|
2020-05-03 18:51:22 +02:00
|
|
|
rm ~/.config/autostart/* || error "Removing startup software failed."
|
2020-05-03 20:04:14 +02:00
|
|
|
|
|
|
|
success "Setup finished successfully :)" && exit 0
|