-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_pacman_packages.sh
executable file
·55 lines (43 loc) · 1.7 KB
/
install_pacman_packages.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
55
#!/usr/bin/env bash
# script for installing pacman packages on Steam Deck
# ATENTION: USE IT AT YOUR OWN RISK!!!!
#
# this will modify root filesystem so it will probably get
# overwrite on system updates but is totally ok executing
# it several times, so if something stops working just
# launch it again
# thanks to àngel "mussol" bosch - [email protected] for https://gist.github.com/muzzol/f01fa6a3134d2ec90d3eb3e241bf541b, the original basis for this script
# get the path to this script
DIR=$(dirname "$0");
echo "$(date) - ${0}";
# grab the package names from the list at ./packages-to-install, but only alphanumeric, "-", "_", "+", ".", and "@"... throw away the rest (and replace /n with " ");
PACKAGES=$(cat "${DIR}/packages-to-install" | grep -wo -E '([-A-Za-z0-9_@\.+])+' | tr '\n' ' ');
# make sure we're root...
echo -n "Checking permissions:";
if [[ "$(id -ru || true)" == "0" ]]; then
echo "OK";
else # exit 1 if not
echo "ERROR!";
echo "this script must be executed by root";
echo "Ex: sudo $0";
exit 1;
fi
## system related comands
echo "Disabling readonly filesystem";
steamos-readonly disable;
# add a symlink so visudo will work (not that we actually need it now, since using kdesu)
if [[ ! -f "/usr/bin/vi" ]]; then
echo "creating symlink /usr/bin/vim -> /usr/bin/vi for visudo";
ln -s /usr/bin/vim /usr/bin/vi;
fi
# set up the keyring if it doesn't exist already
if [[ ! -e "/etc/pacman.d/gnupg/trustdb.gpg" ]]; then
echo "Initalizing pacman keys";
pacman-key --init;
pacman-key --populate archlinux;
fi
echo "Installing packages";
pacman -Sy --noconfirm --overwrite '*' ${PACKAGES};
echo "Re-enabling readonly filesystem";
steamos-readonly enable;
echo "Done";