Hi guys.
@
Blaze @
beny @
ncmprhnsbl and @anyone interested:
I've been using this
script to update nemesis base modules, but it's not working 100%.
Until now, this method works pretty well while updating
xtra,
gui and
xfce base modules.
However,
core one is another matter. Maybe because it has some key files that need to survive the
--overwrite pacman switch. Perhaps
--force instead would do the trick, or maybe using pacman -U instead of pacman -S, but I'm stuck and need some help.
Can anyone give a hand?
Thanks so much.
Cheers!
Script follows:
Code: Select all
#!/bin/bash
# Update NEMESIS base modules ( $PORTDIR/base )
# <https://forum.porteus.org>
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
warn() { echo; echo "$(tput setaf 1) $1 $(tput sgr0)"; echo; }
confirm() { echo; tput setaf 6; read -n1 -rsp "$1"; tput sgr0; echo -e "\n"; [[ $REPLY = [Yy] ]]; }
[ ! $(grep -o 'base' /proc/cmdline) ] && echo "Please init Nemesis with **Always Fresh** boot paramaters" && exit 0;
[ ! $EUID != 0 ] || sudo $(basename $0)
the_end() {
if [ $? == 0 ]; then
dir2xzm /tmp/LOCALES /tmp/LOCALES.xzm
mv /tmp/'*.xzm' $HERE
cd /tmp; rm -r LOCALES $outMOD >/dev/null 2>&1
echo -ne " All Done! \n Your files are here: $HERE"
else
warn " Aborted. Exit code: $?"
fi
unset patches HERE outMOD
eval "exit $?"
}
trap the_end SIGHUP SIGINT SIGTERM
fixPERMS() {
chmod -f 750 $1/root #$1/etc/sudoers.d/ $1/etc/openvpn/client/ $1/etc/openvpn/server/
chmod -f 755 $1/etc $1/etc/local.d $1/usr $1/usr/local $1/usr/local/bin
find $1/usr/share/icons -type d -exec chmod 755 {} + >/dev/null 2>&1
find $1/usr/share/icons -type f -exec chmod 644 {} + >/dev/null 2>&1
}
prepareSYS() {
fixPERMS ""
[ $(pacman -Qu | wc -l) == 0 ] || {
setup-pman # WORKAROUND In case setup-pman fails --> "Please ensure you have a connection and try again. Exit code: 1"
if [ $? == 1 ]; then
pacman-db-upgrade && pacman -Sy
haveged; sleep 3; pacman-key --init; pacman-key --populate archlinux artix; pkill haveged; update-ca-trust;
fi
pacman -Syyu --overwrite '*'
touch /tmp/dbDONE ### avoid iterations
}
echo " System updated!"; echo
}
updateBASE() {
[ -f /tmp/dbDONE ] || prepareSYS
[ ! -d /tmp/LOCALES ] && mkdir -p /tmp/LOCALES
PS3=$'\n'$'\e[00;36mPlease, select base module to update or exit (1-5): \e[0m'
select outMOD in core gui xtra xfce exit
do
patches=""
case $outMOD in
core) patches="{archlinux,artix}-{keyring,mirrorlist}";;
gui) patches="";; #TODO Could be used to interact with the user adding new deps
xtra) patches="";;
xfce) patches="";;
exit*) the_end;;
esac
outMOD="$(basename $(ls -1 $PORTDIR/base | grep -i $outMOD) | cut -d- -f-2)"
break
done
cd /tmp
unsquashfs -f -d $outMOD $PORTDIR/base/$outMOD*
fixPERMS "$outMOD"
### PATCH CORE MODULE. TRICKY ONE AND NOT 100% WORKING AS post transactions hooks (eudev, openrc...) need to run in real root environment, (mountpoints, etc.)
if [ $outMOD == "001-core" ]; then
pacman -Rddr $outMOD {archlinux,artix}-{keyring,mirrorlist}
rm -r $outMOD/etc/pacman.d/gnupg
pacman-key --gpgdir $outMOD/etc/pacman.d/gnupg --init
pacman-key --gpgdir $outMOD/etc/pacman.d/gnupg --populate archlinux artix
fi
cp -au --parents /var/lib/pacman/{sync/,local/ALPM_DB_VERSION} $outMOD
pacman -Qqnr $outMOD | pacman --root $outMOD -Sdd - --overwrite '*'
# UNDO previous patch / apply new deps
[ -z "$patches" ] || eval "pacman -Sddr $outMOD $patches"
cd $outMOD
find usr/share/locale \( -name 'e[ns]_[EU]S' -o -name 'e[ns]' -o -iname 'locale.alias' \) -exec cp -au --parents {} /tmp/LOCALES \;
rm -r usr/share/{doc,gir-1.0,gtk-doc,info,licenses,locale,man} usr/include usr/lib/{pkgconfig,systemd} tmp boot >/dev/null 2>&1
rm -r var/lib/pacman/{sync/,local/ALPM_DB_VERSION} >/dev/null 2>&1
rm etc/ld.so.cache etc/sudo_logsrvd.conf etc/shadow.pacnew etc/sudo.conf
cd /tmp
mv $outMOD/var/log/pacman.log $HERE/$outMOD-pacman.log >/dev/null 2>&1
chown -R 0.0 $outMOD; [ -d $outMOD/home ] && chown -R 1000.1000 $outMOD/home >/dev/null 2>&1
dir2xzm $outMOD "$outMOD"-$(date '+%Y%m%d').xzm
rm -r $outMOD/
}
while confirm "Shall we update [Yy/*]? "; do updateBASE; done
the_end
> Does not compute_
https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=102066#p102066
https://forum.porteus.org/viewtopic.php?p=102306#p102306
https://forum.porteus.org/viewtopic.php?p=72741#p72741