85cc462e1d
* Moved helpers, common and triggers dirs into xbps-src, where they belong. * Renamed the templates dir to srcpkgs, it was so redundant before. * Make it possible to add subpkgs with no restriction in names, for example udev now has a subpkgs called "libgudev". Previously subpkgs were named "${sourcepkg}-${pkgname}". * xbps-src: changed to look for template files in current directory. That means that most arguments from the targets have been removed. * xbps-src: added a reinstall target, to remove + install. * xbps-src: do not overwrite binpkgs by default, skip them. And more that I forgot because it's a mega-commit that I've been working for some days already... --HG-- extra : convert_revision : 0f466878584d1e6895d2a234f07ea1b2d1e61b3e
61 lines
1.1 KiB
Bash
Executable File
61 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Registers or unregisters a shell in /etc/shells.
|
|
#
|
|
# Arguments: $1 = action [run/targets]
|
|
# $2 = target [post-install]
|
|
# $3 = pkgname
|
|
# $4 = version
|
|
#
|
|
|
|
case "$1" in
|
|
targets)
|
|
echo "post-install post-remove"
|
|
;;
|
|
run)
|
|
[ "$2" != "post-install" -a "$2" != "post-remove" ] && exit 1
|
|
|
|
if [ -z "$register_shell" ]; then
|
|
echo "Trigger register-shell: empty \$register_shell!"
|
|
exit 1
|
|
fi
|
|
|
|
case "$2" in
|
|
post-install)
|
|
if [ ! -f etc/shells ]; then
|
|
for f in ${register_shell}; do
|
|
echo $f >> etc/shells
|
|
echo "Registered $f into /etc/shells."
|
|
done
|
|
chmod 644 etc/shells
|
|
else
|
|
for f in ${register_shell}; do
|
|
if ! grep -q $f etc/shells; then
|
|
echo $f >> etc/shells
|
|
echo -n "Registered $f into "
|
|
echo "/etc/shells."
|
|
fi
|
|
done
|
|
fi
|
|
;;
|
|
post-remove)
|
|
if [ -f etc/shells ]; then
|
|
for f in ${register_shell}; do
|
|
if grep -q $f etc/shells; then
|
|
shell=$(echo $f|sed "s|\\/|\\\/|g")
|
|
sed -i -e "/$shell/d" etc/shells
|
|
echo -n "Unregistered $f from "
|
|
echo "/etc/shells."
|
|
fi
|
|
done
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|