File: fuse-utils.postinst

package info (click to toggle)
fuse 2.2.1-4sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,724 kB
  • ctags: 1,059
  • sloc: sh: 8,822; ansic: 7,331; makefile: 213
file content (74 lines) | stat: -rw-r--r-- 1,540 bytes parent folder | download
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
#!/bin/bash -e

. /usr/share/debconf/confmodule
test $DEBIAN_SCRIPT_DEBUG && set -v -x

CONFFILE=/etc/default/fuse-utils

set_option() {
  if [[ -f $CONFFILE ]] && grep -q "^$1=" $CONFFILE; then
    sed -i -e "s,^[# 	]*\($1\)=.*,\1=$2," $CONFFILE
  else
    touch $CONFFILE 
    echo $1=$2 >> $CONFFILE
  fi
}

do_rename_group() { 
  [[ -n $FUSE_GROUP ]] && [[ $FUSE_GROUP != $RET ]]
}

case $1 in
  configure|upgrade)

    ucf --debconf-ok /usr/share/fuse-utils/default $CONFFILE
    [[ -f $CONFFILE ]] && . $CONFFILE

    db_get fuse-utils/group || true
    NEWGROUP=$RET
    MEMBERS=''

    if do_rename_group; then
      db_get fuse-utils/grouprenamemigrate || true
      if [[ $RET = true ]]; then
        MEMBERS=$(getent group $FUSE_GROUP | cut -d: -f4 | tr , ' ')
      fi

      db_get fuse-utils/grouprenamedelete || true
      [[ $RET = true ]] && delgroup $FUSE_GROUP || true
    fi
    
    db_get fuse-utils/groupcreate || true
    if [[ $RET = true ]]; then
      
      db_get fuse-utils/group || true
      addgroup --system $NEWGROUP

      for user in $MEMBERS; do
        adduser $user $NEWGROUP
      done

      dpkg-statoverride --force --update --add root $NEWGROUP 4754 /usr/bin/fusermount || true

    fi

    set_option FUSE_GROUP $NEWGROUP

    db_get fuse-utils/groupdelete || true
    set_option FUSE_GROUPDELETE $RET

    chmod 0644 $CONFFILE
  ;;

  abort-upgrade|abort-remove|abort-deconfigure)
  ;;

  *)
    echo "postinst called with unknown argument \`$1'" >&2
    exit 1
  ;;
esac

#DEBHELPER#

exit 0