Updating/building modules in Nemesis
Posted: 08 Aug 2019, 16:34
From the works of Jack and ncmprhnsbl, I've been sketching some lines to build/update modules on Nemesis. Just putting it all togheter here to save new users from digging around.
Please, feel free to improve it and report back, as I am not a scripting master at all.
Maybe lacks a cd /tmp before unpacking...
Updated. Still dirty work..., but you get the idea.
Thanks.
Please, feel free to improve it and report back, as I am not a scripting master at all.
Code: Select all
#!/bin/bash
##
## Update module from $PORTDIR/modules by searchinng part of his name
##
## Check for root
if [ `whoami` != "root" ]; then
echo "You must be admin to run this script"
exit
fi
read -p "Input part of module name to update: " modinput
modulo=`basename $(ls $PORTDIR/modules | grep -i $modinput) .xzm`
PATH1=/tmp/$modulo
unsquashfs -f -d $PATH1 $PORTDIR/modules/$modulo.xzm
## 1. Preparation and ensure the cache is clean
# update pacman database
pacman -Sy
# clear package cache
rm /var/cache/pacman/pkg/*
#needed to update packages in an arbitrary path
cp --parents -au /var/lib/pacman/local/ALPM_DB_VERSION $PATH1
OUT1=/tmp/lx
OUT2=/tmp/upall
OUT3=/tmp/uplx
pacman -Qqr $PATH1 | awk '{print $1}' > $OUT1
pacman -Qqu | awk '{print $1}' > $OUT2
sleep 5
## Compare module to find upgrades
comm -12 $OUT2 $OUT1 > $OUT3
## 2. Download the packages to cache without dependency checking
## pacman -Sw / Swdd <list of packages>
## (dd) --> disable dependency checking
pacman -Sddw `cat $PWD/uplx`
## 3. Install the Updated packages to the extracted module
## (dd) --> disable all dependency checking
pacman -Uddr $PATH1 /var/cache/pacman/pkg/*.pkg.tar.xz
## 4. Stripping unneeded files
#......................
# lxstrip.sh BEGIN
#......................
## Some of this stuff could be useful to someone
#cp -au --parents $PATH1/usr/include $PATH2/usr/
#cp -au --parents $PATH1/usr/share/info $PATH2/usr/share/
#cp -au --parents $PATH1/usr/share/doc $PATH2/usr/share/
#cp -au --parents $PATH1/usr/share/gtk-doc $PATH2/usr/share/
#cp -au --parents $PATH1/usr/share/licenses $PATH2/usr/share/
#cp -au --parents $PATH1/usr/share/man $PATH2/usr/share/
#cp -au --parents $PATH1/usr/share/locale $PATH2/usr/share/
#cp -au --parents $PATH1/usr/share/gir-1.0 $PATH2/usr/share/
rm -rf $PATH1/usr/include/*
rm -rf $PATH1/usr/share/info/*
rm -rf $PATH1/usr/share/doc/*
rm -rf $PATH1/usr/share/gtk-doc/*
rm -rf $PATH1/usr/share/licenses/*
rm -rf $PATH1/usr/share/man/*
rm -rf $PATH1/usr/lib/systemd/*
rm -rf $PATH1/tmp
#rm -rf $PATH1/usr/share/gir-1.0/*
#rm $PATH1/usr/bin/gtk3-demo
#rm $PATH1/usr/bin/gtk3-demo-application
#rm $PATH1/usr/bin/gtk3-widget-factory
#rm $PATH1/usr/share/applications/gtk3-demo.desktop
#rm $PATH1/usr/share/applications/gtk3-widget-factory.desktop
rm $PATH1/var/lib/pacman/local/ALPM_DB_VERSION
[[ -f $PATH1/var/log/pacman.log ]] && rm $PATH1/var/log/pacman.log
#......................
# lxstrip.sh END
#......................
## 5. Make the module
[[ -d $PATH1/home ]] && chown guest.users $PATH1/home
chown -R root.root $PATH1
dir2xzm $PATH1/ $PATH1.xzm
## 6.Clean the cache before updating any other modules
pacman -Scc
rm $OUT1 $OUT2 $OUT3
rm -r $PATH1
unset modinput modulo OUT1 OUT2 OUT3 PATH1
Updated. Still dirty work..., but you get the idea.
Thanks.