Clean up install script
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
893d322bdf
commit
33c37eef02
6 changed files with 102 additions and 98 deletions
119
install
119
install
|
@ -34,6 +34,10 @@ DIRECTORIES=(
|
||||||
"Videos"
|
"Videos"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
WORK_DIRECTORIES=(
|
||||||
|
"Work"
|
||||||
|
)
|
||||||
|
|
||||||
# Files which should be symlinked in the home folder
|
# Files which should be symlinked in the home folder
|
||||||
LINKED_FILES_HOME=(
|
LINKED_FILES_HOME=(
|
||||||
".config/autokey"
|
".config/autokey"
|
||||||
|
@ -68,7 +72,6 @@ LINKED_FILES_HOME=(
|
||||||
".config/zathura"
|
".config/zathura"
|
||||||
".config/zsh"
|
".config/zsh"
|
||||||
".local/bin"
|
".local/bin"
|
||||||
".local/share/applications/vim.desktop"
|
|
||||||
".local/share/gnupg/gpg-agent.conf"
|
".local/share/gnupg/gpg-agent.conf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -87,7 +90,8 @@ PERMISSIONS=(
|
||||||
|
|
||||||
# Groups the user should be added to
|
# Groups the user should be added to
|
||||||
ADD_GROUPS=(
|
ADD_GROUPS=(
|
||||||
"bumblebee"
|
"log"
|
||||||
|
"wheel"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Array of systemd services which should be enabled
|
# Array of systemd services which should be enabled
|
||||||
|
@ -102,7 +106,7 @@ SYSTEMD_SERVICES=(
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Install package manager and packages #
|
# Install package manager and packages #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
print_section "Installing requirements"
|
print_section "Installing package requirements"
|
||||||
sudo pacman -S git base-devel --noconfirm --needed
|
sudo pacman -S git base-devel --noconfirm --needed
|
||||||
|
|
||||||
print_section "Installing yay"
|
print_section "Installing yay"
|
||||||
|
@ -128,77 +132,130 @@ yay -S --noconfirm --needed "$(cat "${PACKAGES_DIR}/packages.list")"
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Create directories and symlinks #
|
# Creating directories #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
print_section "Creating directories"
|
print_section "Creating directories"
|
||||||
for dir in "${DIRECTORIES[@]}"
|
for dir in "${DIRECTORIES[@]}"
|
||||||
do
|
do
|
||||||
create_directory "${dir}"
|
print_log "Creating directory ${YELLOW}${HOME}/${dir}${RESET}"
|
||||||
|
mkdir -p "${HOME}/${dir}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "${IS_WORK}" = "1" ]; then
|
||||||
|
print_section "Creating work directories"
|
||||||
|
for dir in "${WORK_DIRECTORIES[@]}"
|
||||||
|
do
|
||||||
|
print_log "Creating directory ${YELLOW}${HOME}/${dir}${RESET}"
|
||||||
|
mkdir -p "${HOME}/${dir}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Creating symlinks #
|
||||||
|
###############################################################################
|
||||||
print_section "Creating symlinks"
|
print_section "Creating symlinks"
|
||||||
for file in "${LINKED_FILES_HOME[@]}";
|
for file in "${LINKED_FILES_HOME[@]}";
|
||||||
do
|
do
|
||||||
create_link "${file}"
|
print_log "Linking ${YELLOW}${HOME}/${file}${RESET} to ${YELLOW}${SYSTEM_DIR}/${file}${RESET}"
|
||||||
|
rm -rf "${HOME:?}/${file}"
|
||||||
|
ln -fs "${SYSTEM_DIR}/${file}" "${HOME}/${file}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
for file in "${!LINKED_FILES[@]}"; do
|
for file in "${!LINKED_FILES[@]}"; do
|
||||||
print_log "Linking ${YELLOW}${file}${RESET} -> ${YELLOW}${LINKED_FILES[${file}]}${RESET}"
|
print_log "Linking ${YELLOW}${file}${RESET} to ${YELLOW}${LINKED_FILES[${file}]}${RESET}"
|
||||||
rm -rf "${file}"
|
rm -rf "${file}"
|
||||||
ln -fs "${LINKED_FILES[${file}]}" "${file}"
|
ln -fs "${LINKED_FILES[${file}]}" "${file}"
|
||||||
done
|
done
|
||||||
|
|
||||||
print_section "Give permissions"
|
|
||||||
|
###############################################################################
|
||||||
|
# Giving permissions #
|
||||||
|
###############################################################################
|
||||||
|
print_section "Giving permissions"
|
||||||
for permission in "${!PERMISSIONS[@]}"; do
|
for permission in "${!PERMISSIONS[@]}"; do
|
||||||
set_permission "${USER}" "${PERMISSIONS[${permission}]}" "${permission}"
|
print_log "Changing owner of ${YELLOW}${permission}${RESET} to ${YELLOW}${USER}${RESET}"
|
||||||
|
sudo chown -R "${USER}" ""${permission}""
|
||||||
|
print_log "Changing permission of ${YELLOW}"${permission}"${RESET} to ${YELLOW}${PERMISSIONS[${permission}]}${RESET}"
|
||||||
|
sudo chmod -R "${PERMISSIONS[${permission}]}" "${permission}"
|
||||||
done
|
done
|
||||||
|
|
||||||
print_section "Add user to groups"
|
|
||||||
|
###############################################################################
|
||||||
|
# Adding user to groups #
|
||||||
|
###############################################################################
|
||||||
|
print_section "Adding user to groups"
|
||||||
for group in "${ADD_GROUPS[@]}"
|
for group in "${ADD_GROUPS[@]}"
|
||||||
do
|
do
|
||||||
add_to_group "${USER}" "${group}"
|
print_log "Adding user ${YELLOW}${USER}${RESET} to group ${YELLOW}${group}${RESET}"
|
||||||
|
sudo gpasswd -a "${USER}" "${group}" > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Copying systemd services #
|
||||||
|
###############################################################################
|
||||||
print_section "Copying systemd services"
|
print_section "Copying systemd services"
|
||||||
for file in "${SYSTEM_DIR}/etc/systemd/system/"*
|
for file in "${SYSTEM_DIR}/etc/systemd/system/"*
|
||||||
do
|
do
|
||||||
print_log "Copy ${YELLOW}$(basename "${file}")${RESET} to ${YELLOW}/etc/systemd/system${RESET}"
|
print_log "Copying ${YELLOW}$(basename "${file}")${RESET} to ${YELLOW}/etc/systemd/system${RESET}"
|
||||||
sudo install -m 644 "${file}" "/etc/systemd/system"
|
sudo install -m 644 "${file}" "/etc/systemd/system"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Enabling systemd services #
|
||||||
|
###############################################################################
|
||||||
print_section "Enabling systemd services"
|
print_section "Enabling systemd services"
|
||||||
for service in "${SYSTEMD_SERVICES[@]}"
|
for service in "${SYSTEMD_SERVICES[@]}"
|
||||||
do
|
do
|
||||||
enable_service "${service}"
|
print_log "Enabling service ${YELLOW}${service}${RESET}"
|
||||||
|
sudo systemctl enable "${service}"
|
||||||
done
|
done
|
||||||
|
|
||||||
print_section "Copy custom udev rules"
|
|
||||||
|
###############################################################################
|
||||||
|
# Enabling systemd services #
|
||||||
|
###############################################################################
|
||||||
|
print_section "Copying custom udev rules"
|
||||||
for file in "${SYSTEM_DIR}/etc/udev/rules.d/"*.rules
|
for file in "${SYSTEM_DIR}/etc/udev/rules.d/"*.rules
|
||||||
do
|
do
|
||||||
copy_udev_rule "${file}"
|
print_log "Copying ${YELLOW}$(basename "${file}")${RESET} to ${YELLOW}/etc/udev/rules.d/${RESET}"
|
||||||
|
sudo cp "${file}" "/etc/udev/rules.d/"
|
||||||
done
|
done
|
||||||
sudo udevadm control --reload-rules
|
sudo udevadm control --reload-rules
|
||||||
|
|
||||||
print_section "Copy sudoers content"
|
|
||||||
for file in "${SYSTEM_DIR}/etc/sudoers.d/"*
|
|
||||||
do
|
|
||||||
copy_sudoers_content "${file}"
|
|
||||||
done
|
|
||||||
|
|
||||||
print_section "Copy other files"
|
###############################################################################
|
||||||
print_log "Copy ${SYSTEM_DIR}/etc/docker/daemon.json"
|
# Copying other files #
|
||||||
|
###############################################################################
|
||||||
|
print_section "Copying other files"
|
||||||
|
|
||||||
|
print_log "Copying custom sudoers file to ${YELLOW}/etc/sudoers.d${RESET}"
|
||||||
|
sudo install -m 0440 "${SYSTEM_DIR}/etc/sudoers.d/severin" "/etc/sudoers.d"
|
||||||
|
|
||||||
|
print_log "Copying docker configuration to ${YELLOW}/etc/docker${RESET}"
|
||||||
sudo install -m 644 "${SYSTEM_DIR}/etc/docker/daemon.json" "/etc/docker"
|
sudo install -m 644 "${SYSTEM_DIR}/etc/docker/daemon.json" "/etc/docker"
|
||||||
|
|
||||||
print_section "Set lockscreen image"
|
|
||||||
echo "${DOTFILES}/assets/lockscreen.${HOST}.jpg"
|
|
||||||
betterlockscreen -u "${DOTFILES}/assets/lockscreen.${HOST}.jpg"
|
|
||||||
|
|
||||||
print_section "Create issue file"
|
###############################################################################
|
||||||
|
# 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}';
|
echo '\e{red}';
|
||||||
< "/etc/hostname" tr '[:lower:]' '[:upper:]' | figlet -f big | sed "s/\\\\/\\\\\\\/g";
|
< "/etc/hostname" tr '[:lower:]' '[:upper:]' | figlet -f big | sed "s/\\\\/\\\\\\\/g";
|
||||||
echo -e "\\\r (\\\l)";
|
echo -e "\\\r (\\\l)";
|
||||||
echo '\e{reset}';
|
echo '\e{reset}';
|
||||||
} >> "/tmp/issue"
|
} >> "/tmp/issue"
|
||||||
sudo mv "/tmp/issue" "/etc/issue"
|
sudo install "/tmp/issue" "/etc/issue"
|
||||||
print_log "Issue file created"
|
print_log "Issue file created"
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.95.6",
|
"version": "0.95.7",
|
||||||
"userCodeDir": null,
|
"userCodeDir": null,
|
||||||
"settings": {
|
"settings": {
|
||||||
"isFirstRun": true,
|
"isFirstRun": true,
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
#
|
#
|
||||||
# USAGE:
|
# USAGE:
|
||||||
# This script is sourced by .bashrc
|
# This script is sourced by .bashrc
|
||||||
|
# XDG_Base_Directories
|
||||||
if [ -f "${XDG_BIN_HOME}/utils" ]; then
|
if [ -f "${XDG_BIN_HOME}/utils" ]; then
|
||||||
. "${XDG_BIN_HOME}/utils"
|
. "${XDG_BIN_HOME}/utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# XDG_Base_Directories
|
|
||||||
export XDG_CONFIG_HOME="${HOME}/.config"
|
export XDG_CONFIG_HOME="${HOME}/.config"
|
||||||
export XDG_CACHE_HOME="${HOME}/.cache"
|
export XDG_CACHE_HOME="${HOME}/.cache"
|
||||||
export XDG_DATA_HOME="${HOME}/.local/share"
|
export XDG_DATA_HOME="${HOME}/.local/share"
|
||||||
|
@ -23,6 +23,13 @@ export XDG_BIN_HOME="${HOME}/.local/bin"
|
||||||
export XDG_LOG_HOME="${HOME}/.local/log"
|
export XDG_LOG_HOME="${HOME}/.local/log"
|
||||||
export DOTFILES="${HOME}/dotfiles"
|
export DOTFILES="${HOME}/dotfiles"
|
||||||
|
|
||||||
|
export HOST="$(hostname)"
|
||||||
|
if [ "${HOST}" = "odin" ]; then
|
||||||
|
export IS_WORK="1"
|
||||||
|
else
|
||||||
|
export IS_WORK="0"
|
||||||
|
fi
|
||||||
|
|
||||||
# XDG Overrides for unsupported programs
|
# XDG Overrides for unsupported programs
|
||||||
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME}/httpie"
|
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME}/httpie"
|
||||||
export WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
|
export WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
|
||||||
|
@ -52,9 +59,6 @@ export TASKRC="${XDG_CONFIG_HOME}/task/taskrc"
|
||||||
mkdir -p "${XDG_DATA_HOME}/python"
|
mkdir -p "${XDG_DATA_HOME}/python"
|
||||||
export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
|
export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
|
||||||
|
|
||||||
# Nvidia
|
|
||||||
export __GL_SHADER_DISK_CACHE_PATH="/tmp"
|
|
||||||
|
|
||||||
# zsh
|
# zsh
|
||||||
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
|
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
|
||||||
export HISTFILE="${XDG_DATA_HOME}/zsh/history"
|
export HISTFILE="${XDG_DATA_HOME}/zsh/history"
|
||||||
|
@ -71,7 +75,7 @@ fi
|
||||||
# Setting applications
|
# Setting applications
|
||||||
export VISUAL=vim
|
export VISUAL=vim
|
||||||
export EDITOR="${VISUAL}"
|
export EDITOR="${VISUAL}"
|
||||||
export TERMINAL=termite
|
export TERMINAL="termite"
|
||||||
export BROWSER="google-chrome-beta"
|
export BROWSER="google-chrome-beta"
|
||||||
export PAGER="less"
|
export PAGER="less"
|
||||||
export MANPAGER="${PAGER}"
|
export MANPAGER="${PAGER}"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Outputs #
|
# Outputs #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
set $output1 HDMI1
|
set $output1 HDMI-1-1
|
||||||
set $output2 eDP1
|
set $output2 eDP-1-1
|
||||||
# SCRIPT NAME:
|
# SCRIPT NAME:
|
||||||
# .config/i3/config.base
|
# .config/i3/config.base
|
||||||
#
|
#
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
# This file is automatically used by Streamlink.
|
# This file is automatically used by Streamlink.
|
||||||
player=mpv
|
player=mpv
|
||||||
player-no-close
|
player-no-close
|
||||||
twitch-oauth-token=30ktx6jc273cdc9gmkb7jftny3vrgn
|
twitch-oauth-token=fujbnp4d30039odtmsf7sb1xglxfzn
|
|
@ -57,60 +57,3 @@ function print_section() {
|
||||||
function print_log() {
|
function print_log() {
|
||||||
echo -e " • $1"
|
echo -e " • $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Creates the given directory in the home directory
|
|
||||||
# USAGE: create_directory DIRECTORY
|
|
||||||
function create_directory() {
|
|
||||||
print_log "Creating directory ${YELLOW}${HOME}/${1}${RESET}"
|
|
||||||
mkdir -p "${HOME}/${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Creates a symlink of the given file from the home directory to here.
|
|
||||||
# USAGE: create_link FILE
|
|
||||||
function create_link() {
|
|
||||||
print_log "Linking ${YELLOW}${HOME}/${1}${RESET} -> ${YELLOW}${SYSTEM_DIR}/${1}${RESET}"
|
|
||||||
rm -rf "${HOME:?}/$1"
|
|
||||||
ln -fs "${SYSTEM_DIR}/${1}" "${HOME}/${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to set owner and permission of a file
|
|
||||||
# USAGE: set_permission OWNER PERMISSION FILE
|
|
||||||
function set_permission() {
|
|
||||||
print_log "Changing owner of ${YELLOW}${3}${RESET} to ${YELLOW}${1}${RESET}"
|
|
||||||
sudo chown -R "${1}" "${3}"
|
|
||||||
print_log "Changing permission of ${YELLOW}${3}${RESET} to ${YELLOW}${2}${RESET}"
|
|
||||||
sudo chmod -R "${2}" "${3}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to add a user to a group
|
|
||||||
# USAGE add_to_group USER GROUP
|
|
||||||
function add_to_group() {
|
|
||||||
print_log "Add user ${YELLOW}${1}${RESET} to group ${YELLOW}${2}${RESET} "
|
|
||||||
sudo gpasswd -a "${1}" "${2}" > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to enable a service
|
|
||||||
# USAGE: enable_service SERVICE
|
|
||||||
function enable_service() {
|
|
||||||
print_log "Enabling service ${YELLOW}${1}${RESET}"
|
|
||||||
sudo systemctl enable "${1}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to copy a udev rule to /etc/udev/rules.d/
|
|
||||||
# USAGE: copy_udev_rules FILE
|
|
||||||
function copy_udev_rule() {
|
|
||||||
print_log "Copying ${YELLOW}$(basename "${1}")${RESET} to ${YELLOW}/etc/udev/rules.d/${RESET}"
|
|
||||||
sudo cp "${1}" "/etc/udev/rules.d/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to copy sudoers files to /etc/sudoers.d/
|
|
||||||
# USAGE: copy_sudoers_content FILE
|
|
||||||
function copy_sudoers_content() {
|
|
||||||
print_log "Copying ${YELLOW}$(basename "${1}")${RESET} to ${YELLOW}/etc/sudoers.d/${RESET}"
|
|
||||||
|
|
||||||
sudo mkdir -p "/tmp/sudoers"
|
|
||||||
sudo cp "${1}" "/tmp/sudoers/$(basename "${1}")"
|
|
||||||
sudo chmod 0440 "/tmp/sudoers/$(basename "${1}")"
|
|
||||||
sudo cp -a "/tmp/sudoers/$(basename "${1}")" "/etc/sudoers.d/"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue