upgrade-65b3.sh

Final 6.5 beta3 upgrade script - Davide Principi, 02/05/2014 04:56 PM

Download (1.13 KB)

 
1
#!/bin/bash
2

    
3
set -e
4

    
5
# Stop httpd-admin (if still running as admin) then remove the admin
6
# account, if it's present in passwd:
7
{ 
8
    service httpd-admin stop
9
    killall httpd-admin
10
    stop httpd-admin
11
    sleep 5
12
} || :
13

    
14
grep -q admin /etc/passwd && userdel admin
15

    
16
# Fix DB permissions:
17
chown -v root:adm /var/lib/nethserver/db/*
18

    
19
# Move admin key in configuration DB to root:
20
sed -i 's/^admin=/root=/' /var/lib/nethserver/db/configuration
21

    
22
# Clean up /etc/aliases:
23
sed -r -i '/^(# NethServer|root:|admin:)/ d' /etc/aliases
24

    
25
#
26
# Run the upgrade
27
#
28
yum clean all
29
yum update -y
30

    
31
set +e -x
32

    
33
# Refresh group members
34
if rpm -q nethserver-directory &>/dev/null; then
35
    /etc/e-smith/events/actions/group-modify-unix ev
36
    local_users=(`grep -F '=user|' /var/lib/nethserver/db/accounts | cut -d = -f 1`)
37
    lgroupmod -M "`echo ${local_users[*]} | tr ' ' ','`" locals
38
fi
39

    
40
if rpm -q nethserver-ibays &>/dev/null; then
41
    luserdel shared
42
    for IBAY in `grep -F '|OwningGroup|shared' /var/lib/nethserver/db/accounts  | cut -d = -f 1`; do
43
	/sbin/e-smith/db accounts setprop $IBAY OwningGroup locals
44
	chgrp -Rv locals /var/lib/nethserver/ibay/$IBAY 
45
    done
46
fi