Magellan Linux

Contents of /smage/branches/alx-0_6_0/include/alx.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1672 - (show annotations) (download)
Sun Jan 23 00:17:42 2011 UTC (13 years, 3 months ago) by niro
File size: 3881 byte(s)
-added missing postinstall to export_inherits
1 # $Id$
2 # alx specific functions
3
4 # some global includes
5 sminclude cleanutils mtools
6
7 # all deprecated mage-targets
8 DEPRECATED_MAGE_TARGETS="alx_dev alx_livecd alx"
9
10 SPECIAL_VARS="${SPECIAL_VARS} DEPRECATED_MAGE_TARGETS REMOVE_DEPRECATED_MAGE_TARGETS"
11 SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} alx_postinstall"
12
13 alx_postinstall()
14 {
15 local target
16
17 case ${REMOVE_DEPRECATED_MAGE_TARGETS} in
18 1|yes|true|TRUE)
19 for target in ${DEPRECATED_MAGE_TARGETS}
20 do
21 if [[ ! -z $(magequery -n ${PNAME}-${target}) ]]
22 then
23 echo "removing deprecated mage-target '${PNAME}-${target}'"
24 mage uninstall ${PNAME}-${target} || die
25 fi
26 done
27 ;;
28 esac
29 }
30
31 # injects files to given path (defaults to /usr/bin)
32 # mcinjectfile file {/path/to/dest}
33 mcinjectfile()
34 {
35 local file
36 local dest
37
38 [[ -z $1 ]] && die "No etc file given"
39
40 file="${SMAGENAME%/*}/alx/files/$1"
41 dest="$2"
42 if [[ -z $2 ]]
43 then
44 dest=/usr/bin
45 install -d ${BINDIR}/${dest} || die
46 fi
47
48 # install our configfile
49 install -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die
50 }
51
52 # injects executables to given path
53 # mcinjectexec exec {/path/to/dest}
54 mcinjectexec()
55 {
56 local file
57 local dest
58
59 [[ -z $1 ]] && die "No etc file given"
60
61 file="${SMAGENAME%/*}/alx/files/$1"
62 dest="$2"
63 if [[ -z $2 ]]
64 then
65 dest=/usr/bin
66 install -d ${BINDIR}/${dest} || die
67 fi
68
69 # install our configfile
70 install -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die
71 }
72
73 # injects a patch to the sourcecode
74 # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
75 # mcinjectpatch patch
76 mcinjectpatch()
77 {
78 local PATCHOPTS
79 local PATCHFILE
80 local i
81
82 PATCHOPTS=$1
83 PATCHFILE=$2
84
85 if [[ -z $2 ]]
86 then
87 PATCHFILE=$1
88
89 ## patch level auto-detection, get patch level
90 for ((i=0; i < 10; i++))
91 do
92 patch --dry-run -Np${i} -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} > /dev/null
93 if [[ $? = 0 ]]
94 then
95 PATCHOPTS="-Np${i}"
96 break
97 fi
98 done
99 fi
100
101 echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}"
102 patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE}
103 }
104
105 #############################
106 ##### compile functions ####
107 #############################
108
109 # respect multilib!
110 if [[ -z $(typeset -f oldconfigure) ]]
111 then
112 alx_old_mconfigure=alx_old$(typeset -f mconfigure)
113 else
114 alx_old_mconfigure=alx_old$(typeset -f oldmconfigure)
115 fi
116 eval ${alx_old_mconfigure}
117 mconfigure()
118 {
119 local myconf
120 local configurefile
121
122 # get configure instructions from smage dir
123 if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]]
124 then
125 # version specific configure files
126 configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg
127 elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]]
128 then
129 # generic configure files for a package
130 configurefile=${SMAGENAME%/*}/alx/${PNAME}.cfg
131 else
132 configurefile=""
133 fi
134
135 # now read the content
136 if [[ -f ${configurefile} ]]
137 then
138 echo -e "${COLBLUE}*** ${COLGREEN}Using configure info from ${configurefile}${COLDEFAULT}"
139 local line
140 while read line
141 do
142 # ignore empty and commeted lines
143 case "${line}" in
144 \#*|"") continue ;;
145 esac
146
147 echo -e " adding ${COLGREEN}${line}${COLDEFAULT} to ALX_CONFIGURE_OPTS"
148 ALX_CONFIGURE_OPTS+=" ${line}"
149 done < ${configurefile}
150 fi
151
152 alx_oldmconfigure --disable-nls ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die
153 }
154
155 # get custom mcore functions
156 if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom ]]
157 then
158 echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}"
159 source ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom
160 elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.custom ]]
161 then
162 echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}.custom${COLDEFAULT}"
163 source ${SMAGENAME%/*}/alx/${PNAME}.custom
164 fi
165
166 export_inherits postinstall