Clean up install script

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-05-12 23:20:28 +02:00
parent 893d322bdf
commit 33c37eef02
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
6 changed files with 102 additions and 98 deletions

View file

@ -1,5 +1,5 @@
{
"version": "0.95.6",
"version": "0.95.7",
"userCodeDir": null,
"settings": {
"isFirstRun": true,

View file

@ -11,11 +11,11 @@
#
# USAGE:
# This script is sourced by .bashrc
# XDG_Base_Directories
if [ -f "${XDG_BIN_HOME}/utils" ]; then
. "${XDG_BIN_HOME}/utils"
fi
# XDG_Base_Directories
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_CACHE_HOME="${HOME}/.cache"
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 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
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME}/httpie"
export WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
@ -52,9 +59,6 @@ export TASKRC="${XDG_CONFIG_HOME}/task/taskrc"
mkdir -p "${XDG_DATA_HOME}/python"
export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
# Nvidia
export __GL_SHADER_DISK_CACHE_PATH="/tmp"
# zsh
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
export HISTFILE="${XDG_DATA_HOME}/zsh/history"
@ -71,7 +75,7 @@ fi
# Setting applications
export VISUAL=vim
export EDITOR="${VISUAL}"
export TERMINAL=termite
export TERMINAL="termite"
export BROWSER="google-chrome-beta"
export PAGER="less"
export MANPAGER="${PAGER}"

View file

@ -1,8 +1,8 @@
###############################################################################
# Outputs #
###############################################################################
set $output1 HDMI1
set $output2 eDP1
set $output1 HDMI-1-1
set $output2 eDP-1-1
# SCRIPT NAME:
# .config/i3/config.base
#

View file

@ -11,4 +11,4 @@
# This file is automatically used by Streamlink.
player=mpv
player-no-close
twitch-oauth-token=30ktx6jc273cdc9gmkb7jftny3vrgn
twitch-oauth-token=fujbnp4d30039odtmsf7sb1xglxfzn

View file

@ -56,61 +56,4 @@ function print_section() {
function print_log() {
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/"
}
}