summaryrefslogtreecommitdiff
path: root/community/bacula/bacula.install
blob: 4d061ddfab1197b66288274c40b8eb5acc02b8c0 (plain)
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
post_install() {
  if [ -z "`grep '^bacula::' /etc/group`" ]; then
    echo "Adding bacula system group... "
    groupadd -g 77 bacula >& /dev/null
  fi

  if [ -z "`grep '^bacula::' /etc/passwd`" ]; then
    echo "Adding bacula system user... "
    useradd -u 77 -c "Bacula Daemon" -d / -g bacula -s /bin/false bacula
  fi

  echo "Locking Bacula User Account..."
  passwd -l bacula &>/dev/null

  post_upgrade
}

post_upgrade() {

cat << EOM

Note:
==> Please don't forget to config your MySQL database for the program.
==>
==>  1. If you have not init your MySQL DB yet, run mysql_install_db.
==>  2. Run /etc/bacula/scripts/grant_mysql_privileges. This script creates database user
==>     'bacula' with unrestricted rights to the bacula's database. The
==>     script create  user is without any password. You may want to edit
==>     the script before run it.
==>  3. Run /etc/bacula/scripts/create_mysql_database to create the Database
==>     Bacula.
==>  4. Run /etc/bacula/scripts/make_mysql_tables to create tables used by bacula.

==> The archive directory is: /var/cache/bacula

==> Bacula's offical website : http://www.bacula.org

EOM
}

post_remove() {
  echo "Removing Bacula's system users..."
  userdel bacula &> /dev/null
  groupdel bacula &> /dev/null
}

op=$1
shift
[ "$(type -t "$op")" = "function" ] && $op "$@"