You are not logged in.
Pages: 1
Topic closed
I have been unable to find any documentation of exactly how to refer to pacman's installation root from inside the .install script functions. Curious, I started looking through /var/abs/core for some real-world examples that might clue me in. What I found surprised me - from the looks of it, many of the functions there simply assume that their working directory IS the pacman installation root. For example:
/var/abs/core/ca-certificates/ca-certificates.install:
post_install() {
usr/sbin/update-ca-certificates --fresh
}
post_upgrade() {
usr/sbin/update-ca-certificates --fresh
}
pre_remove() {
# clean up certificates
local _backup=$(mktemp)
mv etc/ca-certificates.conf ${_backup}
echo > etc/ca-certificates.conf
usr/sbin/update-ca-certificates --fresh
mv ${_backup} etc/ca-certificates.conf
}
post_remove() {
# remove the cert file if it is empty
[[ -s etc/ssl/certs/ca-certificates.crt ]] || rm -f etc/ssl/certs/ca-certificates.crt
}
And yet, some others seem to assume that the install root is "/", like here:
/var/abs/core/crda/crda.install:
## arg 1: the new package version
post_install() {
echo "Uncomment the right regulatory domain in /etc/conf.d/wireless-regdom."
echo "It will automatically be set when necessary."
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
# In an upgrade from 1.0.1-1 or older, the wireless-regdom file moves from the crda package
# to the new wireless-regdb package. If the user changed the file, it is save to overwrite the one
# from wireless-regdb by the user-defined one
if [ $(vercmp $2 1.0.1-2) -lt 0 ]; then
if [ -f /etc/conf.d/wireless-regdom.pacorig -a -n "$(grep -v ^# /etc/conf.d/wireless-regdom.pacorig 2>/dev/null | grep -v ^$)" ]; then
mv /etc/conf.d/wireless-regdom.pacorig /etc/conf.d/wireless-regdom
fi
fi
}
or here:
/var/abs/core/cryptsetup/encrypt_install:
# vim: set ft=sh:
install ()
{
if [ -z "${CRYPTO_MODULES}" ]; then
MODULES=" dm-crypt $(all_modules "/crypto/") "
else
MODULES=" dm-crypt ${CRYPTO_MODULES} "
fi
FILES=""
SCRIPT="encrypt"
add_dir "/dev/mapper"
[ -f "/sbin/cryptsetup" ] && add_binary "/sbin/cryptsetup" "/sbin/cryptsetup"
[ -f "/usr/sbin/cryptsetup" ] && add_binary "/usr/sbin/cryptsetup" "/sbin/cryptsetup"
add_binary "/sbin/dmsetup"
add_file "/lib/udev/rules.d/10-dm.rules"
add_file "/lib/udev/rules.d/13-dm-disk.rules"
add_file "/lib/udev/rules.d/95-dm-notify.rules"
}
help ()
{
cat<<HELPEOF
This hook allows for an encrypted root device.
HELPEOF
}
Since I'd normally take the PKGBUILDs in /core/ as fairly good examples of what the Arch devs consider best practice, it's leaving me with either two conclusions: this is a bug, or I'm missing something. Any input is appreciated. :)
Offline
We chroot() and then chdir() to the root directory in every install script executed- so it is no assumption at all.
http://projects.archlinux.org/pacman.gi … aa3e7#n421
Preference would be to omit the leading /, but due to the chroot/chdir combo, both should work.
Offline
encrypt_install is a mkinitcpio hook install script and has nothing to do with pacman.
Offline
Why would you register to bump a five year old thread with that comment?
Please don't necrobump.
Closing.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed