Magellan Linux

Contents of /trunk/mage-buildserver/helper/buildserver-clean.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2812 - (show annotations) (download) (as text)
Mon Sep 8 14:54:34 2014 UTC (9 years, 7 months ago) by niro
File MIME type: application/x-sh
File size: 1922 byte(s)
-added buildserver-clean helper
1 #!/bin/bash
2
3 BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver"
4 DEBUG=0
5
6 if [ -f /etc/rc.d/init.d/functions ]
7 then
8 source /etc/rc.d/init.d/functions
9 else
10 die "/etc/rc.d/init.d/functions not found"
11 fi
12 if [ -f /etc/mage.rc.global ]
13 then
14 source /etc/mage.rc.global
15 else
16 die "/etc/mage.rc.global not found"
17 fi
18 if [ -f /etc/mage.rc ]
19 then
20 source /etc/mage.rc
21 else
22 die "/etc/mage.rc not found"
23 fi
24 if [ -f ${MLIBDIR}/mage4.functions.sh ]
25 then
26 source ${MLIBDIR}/mage4.functions.sh
27 else
28 die "${MLIBDIR}/mage4.functions.sh not found"
29 fi
30 if [ -f ${MLIBDIR}/smage2.functions.sh ]
31 then
32 source ${MLIBDIR}/smage2.functions.sh
33 else
34 die "${MLIBDIR}/smage2.functions.sh not found"
35 fi
36
37 # do this at least of all includes to prevent path overwrites
38 env-rebuild
39 source /etc/profile
40
41 # export default path
42 export PATH="${PATH}:${MLIBDIR}"
43
44 die()
45 {
46 echo "ERROR: $@"
47 exit 1
48 }
49
50 is_split_target_magefile()
51 {
52 local mage="$1"
53
54 for target_mage in ${MY_SPLIT_TARGET_MAGEFILES}
55 do
56 if [[ ${mage} = ${target_mage} ]]
57 then
58 return 0
59 fi
60 done
61
62 return 1
63 }
64
65 load_mage_features
66 mage_setup
67
68
69 if [ ! -d ${BUILDSERVER_CACHE_DIR}/protected ]
70 then
71 die "${BUILDSERVER_CACHE_DIR}/protected directory not found."
72 fi
73
74 UNINSTALL_PKGS=""
75 for pkg in $(magequery -i)
76 do
77 pname="$(magename2pname ${pkg})"
78 if [ -f ${BUILDSERVER_CACHE_DIR}/protected/${pname} ]
79 then
80 [[ ${DEBUG} = 0 ]] || echo "'${pname}' is protected, ignored." >&2
81 else
82 magefile=$(get_uninstall_candidates --pname "${pname}")
83 UNINSTALL_PKGS+=" ${magefile}"
84 fi
85 done
86
87 echo
88 echo "---- dependencies ----"
89 echo "UNINSTALL_PKGS:"
90 for pkg in ${UNINSTALL_PKGS}
91 do
92 echo " * ${pkg}"
93 done
94 echo "----------------------"
95
96 # now uninstall the packages
97 if [[ -z ${UNINSTALL_PKGS} ]]
98 then
99 echo "Nothing found to uninstall"
100 else
101 uninstall_packages ${UNINSTALL_PKGS} || die "uninstalling packages"
102
103 ## always run auto etc-update
104 echo "running etc-update"
105 echo "-5" | etc-update
106 fi

Properties

Name Value
svn:executable *