summaryrefslogtreecommitdiffstats
path: root/packaging/Caldera/OpenServer/pkg/cntl/cqs
blob: fec327a298d4398ee9fd5df4aa408f88ee1f43cd (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
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
#!/ibin/sh
#
# The component query script for the Samba component
#
#       %Z% %M% %I% %E% %Q%
#
#       input:
#               $1 - keyword list (e.g. "UPGRADE OLD_CUSTOM_UPGRADE")
#               $2 - package list (e.g. "Samba:<component>:<package> )
#

# Save input arguments
#
keywords=$1
pkgList=$2

# Source in the standard functions library
#
. ccsSetup.sh

# Local Variables
#
installType=FRESH

# set custom install mode
customMode=LAYERED
[ "$IQM_FILE" ] && {
                # Invoking custom from the IQM.  IQM output will be stored
                # in $IQM_FILE.
                customMode="IQM"
}

# Local Functions

##############################################################################
#
# If called with an argument indicating failure, remove any possible saved 
# configuration info.  Exit with arg passed to this function.
#
cleanup()
{
        trap '' 1 2 3 15
        exit $1
}

################################################################################
#
# We are doing a SSO -> SSO upgrade.  
#
Save_SSO_Upgrade_Config()
{
    if [ -f /etc/samba.d/smbusers ]; then
        ex_cmd cp -f /etc/samba.d/smbusers $CCS_PERSISTENT_STORAGE/smbusers
    fi
    if [ -f /etc/samba.d/smbpasswd ]; then
        ex_cmd cp -f /etc/samba.d/smbpasswd ${CCS_PERSISTENT_STORAGE}/smbpasswd
    fi
    if [ -f /etc/samba.d/smb.conf ]; then
        ex_cmd cp -f /etc/samba.d/smb.conf ${CCS_PERSISTENT_STORAGE}/smb.conf
    fi
    if [ -f /etc/samba.d/lmhosts ]; then
        ex_cmd cp -f /etc/samba.d/lmhosts ${CCS_PERSISTENT_STORAGE}/lmhosts
    fi
    if [ -f /etc/samba.d/printers.def ]; then
        ex_cmd cp -f /etc/samba.d/printers.def \
		${CCS_PERSISTENT_STORAGE}/printers.def
    fi

    return 0
}

################################################################################
# main Main MAIN
#
trap "cleanup $FAIL" 1 2 3 15

# Parse keyword list to determine how custom was invoked, the installation type,
# whether we running on the target CPU, and finally if we have access to 
# the target's root filesystem.
#
for k in $keywords
do
	case $k in
	"UPGRADE")
		# SSO -> SSO upgrade
		#
		installType="SSO_UPGRADE"
		;;

	"OLD_CUSTOM_UPGRADE")
		# OLD_CUSTOM -> SSO upgrade
		#
		installType="OLD_UPGRADE"
		;;
	esac
done

case "$installType" in 
"FRESH")
	# No previous version of component on the system.  Perform a 
	# fresh install.
	;;

"SSO_UPGRADE")
	# Existing SSO component upgraded to newer SSO version.
	#
	Save_SSO_Upgrade_Config
	;;
esac

cleanup $OK