-
Notifications
You must be signed in to change notification settings - Fork 0
/
bin-package-sync.sh
executable file
·54 lines (41 loc) · 1.27 KB
/
bin-package-sync.sh
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
#!/bin/bash
# I don't want a meta-package, but I do want a convenient way to sync
# packages from the lists kept in https://github.com/Lizards/arch-installer
WORKING_DIR="/tmp/arch-installer"
function get_package_defs() {
curl -L https://github.com/Lizards/arch-installer/tarball/master | tar -xz --strip-component=1
}
function install_packages() {
# Import GPG keys for AUR packages
grep -v '^ *#' < "chroot/packages/gpg-keys" | while IFS= read -r key
do
gpg --recv-keys "${key}"
done
readarray -t packages < "chroot/packages/arch"
readarray -t aur_packages < "chroot/packages/aur"
aur sync "${aur_packages[@]}"
sudo pacman -Syu
sudo pacman -S --needed --noconfirm "${packages[@]}" "${aur_packages[@]}"
}
function start_services() {
# system services
grep -v '^ *#' < "chroot/services/system" | while IFS= read -r service
do
sudo systemctl enable "${service}"
done
# user services
grep -v '^ *#' < "chroot/services/user" | while IFS= read -r service
do
systemctl --user enable "${service}"
done
}
function main() {
rm -rf "${WORKING_DIR}"
mkdir -p "${WORKING_DIR}"
pushd "${WORKING_DIR}"
get_package_defs
install_packages
start_services
popd
}
main "$@"