1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Id$ |
# $Id$ |
3 |
|
|
|
# setup exit trap for reboot |
|
|
trap_exit() |
|
|
{ |
|
|
if [[ -f /.dist-upgrade ]] |
|
|
then |
|
|
rm -f /.dist-upgrade |
|
|
# force a reboot at this point here |
|
|
( sleep 3 && reboot -f & ); exit 0 |
|
|
fi |
|
|
} |
|
|
trap "trap_exit" EXIT |
|
|
|
|
4 |
# get a suitable environment |
# get a suitable environment |
5 |
source /etc/profile |
source /etc/profile |
6 |
|
|
171 |
mage install ${BASESYSTEM} |
mage install ${BASESYSTEM} |
172 |
unset MAGE_BOOTSTRAP |
unset MAGE_BOOTSTRAP |
173 |
|
|
174 |
# fix locale |
# # fix locale |
175 |
echo "LANG=\"de_DE\"" > /etc/conf.d/locale |
# echo "LANG=\"de_DE\"" > /etc/conf.d/locale |
176 |
|
|
177 |
# enable run of orphaned files check |
# enable run of orphaned files check |
178 |
touch /.orphaned |
touch /.orphaned |
190 |
touch /.orphaned |
touch /.orphaned |
191 |
fi |
fi |
192 |
|
|
|
# etc-update |
|
|
#etc-update |
|
|
|
|
193 |
# clean mage cache |
# clean mage cache |
194 |
mage clean |
mage clean |
195 |
|
|
210 |
mage uninstall ${i} |
mage uninstall ${i} |
211 |
done |
done |
212 |
|
|
213 |
|
if [[ -f /.orphaned ]] |
214 |
|
then |
215 |
|
echo "Searching for orphaned files and directories ..." |
216 |
|
bash /etc/mage-profile/prune-orphaned-files |
217 |
|
rm -f /.orphaned |
218 |
|
fi |
219 |
|
|
220 |
if [[ -f /.dist-upgrade ]] |
if [[ -f /.dist-upgrade ]] |
221 |
then |
then |
222 |
# array of wireless opts |
# array of wireless opts |
259 |
install -d /etc/modprobe.d || die |
install -d /etc/modprobe.d || die |
260 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die |
261 |
# create an updated initrd |
# create an updated initrd |
262 |
local DISKMODS="sd_mod" |
DISKMODS="sd_mod" |
263 |
local OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
264 |
local PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
265 |
local SATAMODS="sata_via sata_sis sata_nv" |
SATAMODS="sata_via sata_sis sata_nv" |
266 |
local DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
267 |
local FBMODS="uvesafb" |
FBMODS="uvesafb" |
268 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd |
269 |
local kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::') |
kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::') |
270 |
mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver} |
mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver} |
271 |
# update grub bootloader |
# update grub bootloader |
272 |
updategrub2 |
updategrub2 |
273 |
fi |
fi |
274 |
|
|
275 |
if [[ -f /.orphaned ]] |
if [[ -f /.dist-upgrade ]] |
276 |
then |
then |
277 |
echo "Searching for orphaned files and directories ..." |
echo "preparing a reboot in 60 seconds ..." |
278 |
bash /etc/mage-profile/prune-orphaned-files |
# reboot via cronjob |
279 |
rm -f /.orphaned |
[[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs |
280 |
|
# setup a proper cronjob |
281 |
|
tmp=$(mktemp) |
282 |
|
echo "* * * * * crontab -r && reboot -f" > ${tmp} |
283 |
|
crontab ${tmp} |
284 |
|
[[ -f ${tmp} ]] && rm -f ${tmp} |
285 |
|
# start cron daemon in background |
286 |
|
crond -b -S |
287 |
fi |
fi |
288 |
|
|
289 |
#if [[ -f /.dist-upgrade ]] |
exit 0 |
|
#then |
|
|
# rm -f /.dist-upgrade |
|
|
# # force a reboot at this point here |
|
|
# ( reboot -f & ); exit 0 |
|
|
#fi |
|