-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·81 lines (66 loc) · 2.23 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env sh
set -e
echo "Finding path to this repo..."
current_directory=$(cd -- "$(dirname -- "$0")" > /dev/null 2>&1 && pwd)
echo "Repo detected at ${current_directory}"
echo "Doing a full system upgrade before starting the installation..."
sudo pacman -Syyu
echo "Installing packages required to run this install script..."
packages="${current_directory}/etc/required.txt"
if [ -s "$packages" ]; then
# shellcheck disable=SC2024
sudo pacman -S --needed - < "$packages"
fi
# Make sure XDG Base Directory Specification is used
XDG_CONFIG_HOME="${HOME}/.config"
XDG_CACHE_HOME="${HOME}/.cache"
XDG_DATA_HOME="${HOME}/.local/share"
XDG_STATE_HOME="${HOME}/.local/state"
echo "Creating directories according to the XDG Base Directory Specification..."
mkdir -vp "${XDG_CONFIG_HOME}"
mkdir -vp "${XDG_CACHE_HOME}"
mkdir -vp "${XDG_DATA_HOME}"
mkdir -vp "${XDG_STATE_HOME}"
echo "Creating directories to avoid them being symlinked..."
mkdir -vp "${HOME}/.local/bin"
mkdir -vp "${HOME}/Pictures"
mkdir -vp "${HOME}/Pictures/Screenshots"
# Unlock encrypted files
echo "Unlocking encrypted files..."
git-crypt unlock
# Use stow to symlink all configuration files, scripts, etc.
echo "Symlinking files with stow..."
stow --verbose=2 --dir "${current_directory}" --target "${HOME}" .
# Install additional packages
echo "Installing additional packages..."
if ! [ -x "$(command -v paru)" ]; then
echo "Installing paru from AUR..."
if (
git clone https://aur.archlinux.org/paru.git
cd paru || exit
makepkg -si --clean
cd ..
rm -rf paru
); then
echo "Failed to install paru" >&2
fi
else
echo "paru already installed, skipping..."
fi
packages="${current_directory}/etc/packages.txt"
if [ -s "$packages" ]; then
# shellcheck disable=SC2024
sudo pacman -S --needed - < "$packages"
fi
packages="${current_directory}/etc/packages_paru.txt"
if [ -s "$packages" ]; then
# shellcheck disable=SC2024
sudo paru -S --needed - < "$packages"
fi
# Finishing up
echo "Setting up crontab"
crontab "${current_directory}/etc/crontab.txt"
echo "Setting up sudoers files"
for file in "${current_directory}/etc/sudoers/"*; do
sudo cp --verbose "${file}" "/etc/sudoers.d/$(basename "${file}")"
done