File: blend-update-usermenus

package info (click to toggle)
blends 0.7.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 792 kB
  • sloc: xml: 5,097; python: 1,003; sh: 705; makefile: 272
file content (51 lines) | stat: -rwxr-xr-x 1,259 bytes parent folder | download | duplicates (5)
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
#!/bin/bash
#
# $Id$ 

usage() {
   echo "Usage: `basename $0` <Blend>"
   echo "Blend:   `getBlendList|tr ' ' '|'`"
   echo
   echo "Updates user menus of all users registered for Blend"
}

# the base dir for Blend 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
. ${CONFBASE}/blends.conf

# specific utilities for blend-update-menus
. ${SHAREDIR}/blend-update-menus

if ! amI root; then
	blendLog "$0 must be called by root.  If you are a normal user just call update-menus ."
	exit 0
fi

case $1 in
	-h|--help|"")
            usage
            exit 0
            ;;
        *)
	    set -e
            checkBlend $1 || \
                blendFail $? "Debian Pure Blend $1 does not exist"
	    BLEND=$1
            set +e
esac

if [ -s /etc/blends/${BLEND}/${BLEND}.conf ] ; then
	. /etc/blends/${BLEND}/${BLEND}.conf
fi

for ROLE in `getBlendRoleList ${BLEND}`; do
        for BLENDUSER in `getUsersInRole ${BLEND} ${ROLE} 1`; do
		# Update user menus if UPDATEUSERMENU is set to yes
            	blendLog "Adding menu for user ${BLENDUSER} of ${BLEND} ..."
            	su ${BLENDUSER} -c "update-menus"
        done
done