/usr/sbin/blend-update-menus is in blends-common 0.6.15ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #!/bin/bash
#
# $Id: blend-update-menus 2111 2010-03-20 21:23:54Z tille $
usage() {
echo "Usage: `basename $0` [ -u <user> | -b <Blend> ]"
echo "Blend: `getBlendList|tr ' ' '|'`"
echo "user: system user registerd to a Blend"
echo
echo "run as user updates only the user's menu script"
}
# the base dir for Blends conffiles, where script expects to find dirs named like
# each registered Blend
CONFBASE=${CONFBASE:-/etc/blends}
# a local per Blend conf is sourced later, after argument parsing
if [ ! -s ${CONFBASE}/blends.conf ] ; then
echo "File ${CONFBASE}/blends.conf is missing. Please check installation of package blends-common."
exit 13
fi
. ${CONFBASE}/blends.conf
# specific utilities for blend-update-menus
if [ ! -s ${SHAREDIR}/blend-update-menus ] ; then
echo "File ${SHAREDIR}/blend-update-menus is missing. Please check installation of package blends-common."
exit 13
fi
. ${SHAREDIR}/blend-update-menus
# Get command line arguments
GETOPT=`getopt -o b:d:u:h --long blend:,user:,help -n "$0" -- "$@"`
eval set -- "$GETOPT"
while true
do
case $1 in
-h|--help)
usage
exit 0
;;
# get blend name
# for compatibility reasons we need to handle -d option
# here as well because postrm of previousely installed
# CDDs are using this option
-b|--blend|-d)
if ! amI root; then
blendLog "You must be root to specify --blend parameter"
blendLog ""
usage
exit 64
elif [ -n "${BLENDUSER}" ]; then
blendLog "You cannot specify --blend and --user at the same time"
blendLog ""
usage
exit 0
else
BLEND=$2
shift 2
fi
;;
# get user name
-u|--user)
BLENDUSER=$2
shift 2
if ! amI root && ! amI "${BLENDUSER}"; then
blendLog "You must be root to specify --user parameter with a user that's not you"
usage
exit 64
elif [ "${BLENDUSER}" == 'root' ]; then
blendFail 64 "err: Menus for user 'root' cannot be updated"
elif [ -n "${BLEND}" ]; then
usage
exit 0
fi
;;
--)
shift
break
;;
*)
blendLog "$1 not recognized as option" >&2
exit 67 # EX_USAGE
;;
esac
done
# update menu scripts for BLENDUSER, for any Blend, if any
if [ -n "${BLENDUSER}" ]; then
SYSSCRIPT="${SHAREDIR}/menu/blend-menu"
USERSCRIPT="`getUserHome ${BLENDUSER}`/.menu/blend-menu"
set -e
checkUser ${BLENDUSER} || \
blendFail 67 "User does not exist"
isUserRegistered ${BLENDUSER} || \
blendFail 67 "User ${BLENDUSER} is not registered to any Blend"
# there's nothing to do on per user basis criteria
#updateUser ${BLENDUSER} "${SYSSCRIPT}" "${USERSCRIPT}"
set +e
# update menu scripts for any user registered into the specified Blend
elif [ -n "${BLEND}" ]; then
# Now that we know the selected Blend, we can check if there is a local
# configuration for it (ie differnt backend from the default one)
test -n "${BLEND}" -a -f ${CONFBASE}/${BLEND}/${BLEND}.conf &&
. ${CONFBASE}/${BLEND}/${BLEND}.conf
set -e
checkBlend ${BLEND} || \
blendFail $? "Debian Pure Blend ${BLEND} does not exist"
# there's nothing to do on per Blend basis criteria
#SYSSCRIPT="${SHAREDIR}/menu/blend-menu"
#updateBlend ${BLEND} "${SYSSCRIPT}"
set +e
else
exec $0 --user `whoami`
fi
|