-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalamares-post-script
executable file
·119 lines (101 loc) · 3.66 KB
/
calamares-post-script
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
# (tpg) this script is executed bu calamares after installation is done
# see https://github.com/OpenMandrivaSoftware/distro-release/blob/master/installer/shellprocess.conf
wipe_locale()
{
local lang list nosed engb
lang=$(grep ^LANG= /etc/locale.conf | sed 's/.*=//g' | sed 's/_.*//g')
[ -z "$lang" ] && printf '%s\n' "Error: Cannot find locale settings" && exit 1
case $lang in
C*) nosed=1 ;;
*) nosed=0 ;;
esac
## let -en* stuff always be there , some apps may just have stubs
## or incomplete translation and that always has an failback to en_*
list=$(dnf -C -q list installed | grep ^locales- | awk '{print $1}' | rev | cut -d. -f2- |rev | grep -v locales-en |grep -v locales-extra-charsets)
# (crazy) disable for now , myspell build changes and now -en packages
# provides en_GB so we cannot remove anymore like this
# if [ "$lang" != 'en' ]; then
# engb=(libreoffice-l10n-en_GB myspell-en_GB firefox-en_GB)
# list=(${list[@]} ${engb[@]})
# fi
## now simple run remove
if [[ -n ${list[@]} ]]; then
printf '%s\n' "Removing not needed language packages.."
if [ $nosed -eq 0 ]; then
dnf --disablerepo="*" -C -y remove ${list[@]/locales-$lang}
else
dnf --disablerepo="*" -C -y remove ${list[@]}
fi
else
printf '%s\n' "Nothing to do.."
fi
}
wipe_vbox()
{
local dmifile
dmifile=$(cat /sys/class/dmi/id/product_name)
[ -z "$dmifile" ] && printf '%s\n' "Warning: DMI product_name entry empty?"
if [ "$dmifile" = 'VirtualBox' ]; then
printf '%s\n' "Looks like a VirtualBox VM, keeping virtualbox packages."
else
printf '%s\n' "We are not on VirtualBox , removing virtualbox-guest-additions"
dnf --disablerepo="*" -C -y remove virtualbox-guest-additions
fi
}
wipe_spice()
{
local dmifile
dmifile=$(cat /sys/class/dmi/id/sys_vendor)
[ -z "$dmifile" ] && printf '%s\n' "Warning: DMI sys_vendor entry empty"
if [ "$dmifile" = 'QEMU' ]; then
printf '%s\n' "Looks like a QEmu VM, keeping spice packages."
else
printf '%s\n' "We are not on QEmu, removing spice-vdagent"
dnf --disablerepo="*" -C -y remove spice-vdagent
fi
}
iso_stuff()
{
local i
printf '%s\n' "Cleaning up.."
## for unknown reson firewalld has somehow some script error
## and a file '1' is installed into rootfs..
## Might be a 2>/1 instead of 2>&1 somewhere?
[ -e /1 ] && rm -rf /1
## /root/tmp ?
[ -d /root/tmp ] && rm -rf /root/tmp
## /live
[ -d /live ] && rm -rf /live
# remove sshd config for live iso
[ -f /etc/ssh/sshd_config.d/50-live-iso.conf ] && rm -rf /etc/ssh/sshd_config.d/50-live-iso.conf
## Make sure we default to the right session and not "fallback" (which comes
## before plasma in the alphabet)
if [ -e /etc/sddm.conf ]; then
if ! grep -q DefaultSession /etc/sddm.conf; then
if [ -e /usr/share/xsessions/plasmax11.desktop ]; then
sed -i -e '/\[General\]/aDefaultSession=plasmax11' /etc/sddm.conf
elif [ -e /usr/share/wayland-sessions/plasma.desktop -o -e /usr/share/xsessions/plasma.desktop ]; then
sed -i -e '/\[General\]/aDefaultSession=plasma' /etc/sddm.conf
elif [ -e /usr/share/wayland-sessions/plasmawayland.desktop ]; then
sed -i -e '/\[General\]/aDefaultSession=plasmawayland' /etc/sddm.conf
elif [ -e /usr/share/xsessions/lxqt.desktop -o -e /usr/share/wayland-sessions/lxqt.desktop ]; then
sed -i -e '/\[General\]/aDefaultSession=lxqt' /etc/sddm.conf
fi
fi
fi
## clean .bak .rpmsave files .. strange to have
## an fresh installed system with the on it
for i in $(ls /etc/*.{bak,rpmsave}); do
rm -rf "$i"
done
# game requested for Live session
dnf --disablerepo="*" -C -y remove kpat
chown -R rpm:rpm /var/lib/rpm
rm -rf /var/lib/rpm/.dbenv.lock
rm -rf /var/lib/rpm/.rpm.lock
}
wipe_locale
iso_stuff
wipe_vbox
wipe_spice