-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathutils.sh
executable file
·48 lines (43 loc) · 1.56 KB
/
utils.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
#!/bin/bash
# general utils used by multiple parts of instantARCH
updaterepos() {
pacman -Sy --noconfirm || return 1
if [ -z "$UPDATEDKEYRING" ]; then
pacman -S archlinux-keyring --noconfirm || exit 1
pacman-key --populate || exit 1
export UPDATEDKEYRING="true"
fi
if pacman -Si bash 2>&1 | grep -iq 'unrecognized archive'; then
echo 'getting new mirrorlist'
curl -s 'https://archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&use_mirror_status=on' | sed 's/^#//g' >/etc/pacman.d/mirrorlist
rm /var/lib/pacman/sync/*
pacman -Sy --noconfirm || return 1
if pacman -Si bash 2>&1 | grep -iq 'unrecognized archive'; then
echo 'still problems, shuffling mirrorlist'
curl -s 'https://archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&use_mirror_status=on' | sed 's/^#//g' | shuf >/etc/pacman.d/mirrorlist
rm /var/lib/pacman/sync/*
fi
pacman -Sy --noconfirm || return 1
fi
}
# check if installation is run from an instantOS gui session or
# other desktop or tty
# all instantMENU specific features are turned off without guimode
checkguimode() {
if [ -e /usr/share/liveutils ] && ! [ -e /tmp/nogui ] && [ -z "$CLIMODE" ]; then
echo "GUI Mode active"
export GUIMODE="True"
GUIMODE="True"
fi
}
guimode() {
if [ -e /opt/noguimode ]; then
return 1
fi
if [ -n "$GUIMODE" ]; then
return 0
else
return 1
fi
}
export IMPORTEDUTILS="true"