1 |
#!/bin/sh |
#!/bin/bash |
2 |
# Magellan Linux Installer (mage.sh) |
# Magellan Linux Installer (mage.sh) |
3 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.5 2005-09-10 13:35:31 niro Exp $ |
# $Id$ |
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
7 |
{ |
{ |
8 |
|
xtitleclean |
9 |
|
mqueryfeature "debug" && echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} |
10 |
echo -e ${COLRED}"$@"${COLDEFAULT} |
echo -e ${COLRED}"$@"${COLDEFAULT} |
11 |
exit 1 |
exit 1 |
12 |
} |
} |
16 |
source /etc/mage.rc.global || \ |
source /etc/mage.rc.global || \ |
17 |
die "/etc/mage.rc.global missing" |
die "/etc/mage.rc.global missing" |
18 |
|
|
19 |
[ -f /etc/mage.rc ] && source /etc/mage.rc || \ |
[ -f ${MAGERC} ] && source ${MAGERC} || \ |
20 |
die "Your /etc/mage.rc is missing. Aborting." |
die "Your ${MAGERC} is missing. Aborting." |
21 |
|
|
22 |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
23 |
source ${MLIBDIR}/mage4.functions.sh || \ |
source ${MLIBDIR}/mage4.functions.sh || \ |
24 |
die "mage functions missing" |
die "mage functions missing" |
25 |
|
|
|
# for tests only |
|
|
#source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global |
|
|
#source /etc/mage.rc |
|
|
#source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh |
|
|
#MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage |
|
|
|
|
|
## only for tests -> normally in /etc/rc.d/init.d/functions |
|
|
COLRED="\033[1;6m\033[31m" |
|
|
COLGREEN="\033[1;6m\033[32m" |
|
|
COLYELLOW="\033[1;6m\033[33m" |
|
|
COLBLUE="\033[1;6m\033[34m" |
|
|
COLMAGENTA="\033[1;6m\033[35m" |
|
|
COLWHITE="\033[1;6m\033[37m" |
|
|
COLGRAY="\033[0;6m\033[37m" |
|
|
COLDEFAULT="\033[0m" |
|
|
|
|
|
if [[ ${NOCOLORS} = true ]] |
|
|
then |
|
|
COLRED="" |
|
|
COLGREEN="" |
|
|
COLYELLOW="" |
|
|
COLBLUE="" |
|
|
COLMAGENTA="" |
|
|
COLWHITE="" |
|
|
COLGRAY="" |
|
|
COLDEFAULT="" |
|
|
fi |
|
|
|
|
26 |
# export default path |
# export default path |
27 |
export PATH="${PATH}:${MLIBDIR}" |
export PATH="${PATH}:${MLIBDIR}" |
28 |
|
|
32 |
# sanity checks |
# sanity checks |
33 |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
34 |
|
|
35 |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]] |
36 |
then |
then |
37 |
echo |
echo |
38 |
echo "Please choose an profile from the mage tree." |
echo "Please choose an profile from the mage tree." |
41 |
fi |
fi |
42 |
|
|
43 |
# default messages |
# default messages |
44 |
showversion() { |
showversion() |
45 |
|
{ |
46 |
local MAGEVERSION="$(< ${MLIBDIR}/version)" |
local MAGEVERSION="$(< ${MLIBDIR}/version)" |
47 |
|
|
48 |
echo -en "Magellan Package Manager v${MAGEVERSION} " |
echo -en "Magellan Package Manager v${MAGEVERSION} " |
49 |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
50 |
} |
} |
51 |
|
|
52 |
print_usage(){ |
print_usage() |
53 |
showversion |
{ |
54 |
echo |
#showversion |
55 |
|
#echo |
56 |
echo "Usage: $(basename $0) [option] pkgname ..." |
echo "Usage: $(basename $0) [option] pkgname ..." |
57 |
echo "Options:" |
echo "Options:" |
58 |
echo " pretend - pretends dependencies of a package" |
echo " pretend - pretends dependencies of a package" |
59 |
echo " srcpretend - pretends dependencies of a package (build from source)" |
echo " srcpretend - pretends dependencies of a package (build from source)" |
60 |
echo " install - installs a package" |
echo " install - installs a package" |
61 |
echo " srcinstall - installs a package from source" |
echo " srcinstall - installs a package from source" |
62 |
echo " uninstall - removes a package" |
echo " uninstall - removes a package" |
63 |
echo " update - updates mage-tree" |
echo " update - updates the mage-tree via rsync" |
64 |
echo " uppretend - pretend dependencies for a system upgrade" |
echo " update-tarball - updates the mage-tree via a tarball" |
65 |
echo " upgrade - runs a complete system upgrade" |
echo " uppretend - pretend dependencies for a system upgrade" |
66 |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
echo " upgrade - runs a complete system upgrade" |
67 |
echo " srcupgrade - runs a complete system upgrade from source" |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
68 |
echo " search - searches mage-tree for a package" |
echo " srcupgrade - runs a complete system upgrade from source" |
69 |
echo " clean - removes *all* downloaded packages" |
echo " pretend-build-prerequisites" |
70 |
echo " unpack - unpacks *all* needed package for 'foo'" |
echo " install-build-prerequisites" |
71 |
echo " download - downloads *all* needed packages for 'foo'" |
echo " search - searches mage-tree for a package" |
72 |
echo " version - prints version info" |
echo " clean - removes *all* downloaded packages" |
73 |
|
echo " unpack - unpacks *all* needed package for 'foo'" |
74 |
|
echo " download - downloads *all* needed packages for 'foo'" |
75 |
|
echo " print-features - prints all enabled mage-features" |
76 |
|
echo " version - prints version info" |
77 |
|
echo " regen-mage-tree - regenerates the whole mage database (for devs only)" |
78 |
echo |
echo |
79 |
echo "Other options:" |
echo "Other options:" |
80 |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
81 |
# echo "Builds a Package with its dependencies, but won't install anything." |
# echo "Builds a Package with its dependencies, but won't install anything." |
82 |
# echo |
# echo |
83 |
echo "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE" |
echo "MAGE_DISTRIBUTION=unstable $(basename $0) [src]install PACKAGE" |
84 |
echo "Overrides stable packages; you can install packages that are marked unstable." |
echo "Overrides stable packages; you can install packages that are marked unstable." |
85 |
echo |
echo |
86 |
echo "USE_TESTING=true $(basename $0) [src]install PACKAGE" |
echo "MAGE_DISTRIBUTION=testing $(basename $0) [src]install PACKAGE" |
87 |
echo "Overrides stable packages; you can install packages that are marked testing." |
echo "Overrides stable packages; you can install packages that are marked testing." |
88 |
echo |
echo |
89 |
echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" |
echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" |
95 |
showversion |
showversion |
96 |
echo |
echo |
97 |
|
|
|
# before anything run mage_setup |
|
|
mage_setup || die "error in mage_setup()" |
|
|
|
|
98 |
# install method |
# install method |
99 |
METHOD="$1" |
METHOD="$1" |
100 |
|
|
101 |
# initial unversionized packagename, gets overridden later |
# initial unversionized packagename, gets overridden later on |
102 |
MAGENAME="$2" |
MAGENAME="$2" |
103 |
|
|
104 |
if [[ ${METHOD} != upgrade ]] && \ |
if [[ ${METHOD} != upgrade ]] && |
105 |
[[ ${METHOD} != srcupgrade ]] && \ |
[[ ${METHOD} != srcupgrade ]] && |
106 |
[[ ${METHOD} != uppretend ]] && \ |
[[ ${METHOD} != uppretend ]] && |
107 |
[[ ${METHOD} != srcuppretend ]] && \ |
[[ ${METHOD} != srcuppretend ]] && |
108 |
[[ ${METHOD} != update ]] && \ |
[[ ${METHOD} != update ]] && |
109 |
[[ ${METHOD} != clean ]] && \ |
[[ ${METHOD} != update-tarball ]] && |
110 |
[[ ${METHOD} != version ]] && \ |
[[ ${METHOD} != clean ]] && |
111 |
[[ ${METHOD} != search ]] && \ |
[[ ${METHOD} != version ]] && |
112 |
[[ ${METHOD} != regen-mage-tree ]] |
[[ ${METHOD} != search ]] && |
113 |
|
[[ ${METHOD} != regen-mage-tree ]] && |
114 |
|
[[ ${METHOD} != print-features ]] |
115 |
then |
then |
116 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
117 |
fi |
fi |
118 |
|
|
119 |
|
# set PKGDIR and BUILDDIR to MROOT |
120 |
|
if [[ -n ${MROOT} ]] |
121 |
|
then |
122 |
|
PKGDIR=${MROOT}/${PKGDIR} |
123 |
|
BUILDDIR=${MROOT}/${BUILDDIR} |
124 |
|
fi |
125 |
|
|
126 |
|
# before anything run mage_setup |
127 |
|
mage_setup || die "error in mage_setup()" |
128 |
|
|
129 |
|
# load supported mage features |
130 |
|
load_mage_features |
131 |
|
|
132 |
|
# query debug mode |
133 |
|
if mqueryfeature "debug" |
134 |
|
then |
135 |
|
depwalker_debug="--debug" |
136 |
|
else |
137 |
|
depwalker_debug="" |
138 |
|
fi |
139 |
|
|
140 |
case ${METHOD} in |
case ${METHOD} in |
141 |
download) |
download) |
142 |
|
have_root_privileges || die "You must be root to run this operation." |
143 |
|
|
144 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
145 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
146 |
|
|
148 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
149 |
|
|
150 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
151 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
152 |
|
|
153 |
|
# package is masked |
154 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
155 |
|
|
156 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
157 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
165 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
166 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
167 |
--pver ${PVER} \ |
--pver ${PVER} \ |
168 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
169 |
|
${depwalker_debug})" |
170 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
171 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
172 |
;; |
;; |
173 |
|
|
174 |
srcdownload) |
srcdownload) |
175 |
|
have_root_privileges || die "You must be root to run this operation." |
176 |
|
|
177 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
178 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
179 |
|
|
181 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
182 |
|
|
183 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
184 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
185 |
|
|
186 |
|
# package is masked |
187 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
188 |
|
|
189 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
190 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
198 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
199 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
200 |
--pver ${PVER} \ |
--pver ${PVER} \ |
201 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
202 |
|
${depwalker_debug})" |
203 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
204 |
;; |
;; |
205 |
|
|
206 |
pretend|srcpretend) |
pretend|srcpretend|pretend-build-prerequisites) |
207 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
208 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
209 |
|
|
211 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
212 |
|
|
213 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
214 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
215 |
|
|
216 |
|
# package is masked |
217 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
218 |
|
|
219 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
220 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
236 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
237 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
238 |
--pver ${PVER} \ |
--pver ${PVER} \ |
239 |
--pbuild ${PBUILD} |
--pbuild ${PBUILD} \ |
240 |
|
${depwalker_debug} |
241 |
;; |
;; |
242 |
|
|
243 |
install) |
install|install-build-prerequisites) |
244 |
|
have_root_privileges || die "You must be root to run this operation." |
245 |
|
|
246 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
247 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
248 |
|
|
250 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
251 |
|
|
252 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
253 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
254 |
|
|
255 |
|
# package is masked |
256 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
257 |
|
|
258 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
259 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
264 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
265 |
then |
then |
266 |
echo -en "Package " |
echo -en "Package " |
267 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
268 |
echo -e " already installed." |
echo -e " already installed." |
269 |
exit 3 |
exit 3 |
270 |
fi |
fi |
275 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
276 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
277 |
--pver ${PVER} \ |
--pver ${PVER} \ |
278 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
279 |
|
${depwalker_debug})" |
280 |
|
|
281 |
# first fetch all packages |
# first fetch all packages |
282 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
283 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
|
unpack_packages ${ALLDEPS} || die "unpacking packages" |
|
284 |
install_packages ${ALLDEPS} || die "installing packages" |
install_packages ${ALLDEPS} || die "installing packages" |
285 |
;; |
;; |
286 |
|
|
287 |
srcinstall) |
srcinstall) |
288 |
|
have_root_privileges || die "You must be root to run this operation." |
289 |
|
|
290 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
291 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
292 |
|
|
294 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
295 |
|
|
296 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
297 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
298 |
|
|
299 |
|
# package is masked |
300 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
301 |
|
|
302 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
303 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
308 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
309 |
then |
then |
310 |
echo -en "Package " |
echo -en "Package " |
311 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
312 |
echo -e " already installed." |
echo -e " already installed." |
313 |
exit 3 |
exit 3 |
314 |
fi |
fi |
319 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
320 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
321 |
--pver ${PVER} \ |
--pver ${PVER} \ |
322 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
323 |
|
${depwalker_debug})" |
324 |
|
|
325 |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
326 |
;; |
;; |
327 |
|
|
328 |
uninstall) |
uninstall) |
329 |
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
have_root_privileges || die "You must be root to run this operation." |
330 |
if [ -z "${ALLDEPS}" ] |
|
331 |
then |
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
332 |
die "No package installed named '${MAGENAME}'." |
if [ -z "${ALLDEPS}" ] |
333 |
fi |
then |
334 |
uninstall_packages ${ALLDEPS} |
die "No package installed named '${MAGENAME}'." |
335 |
|
fi |
336 |
|
uninstall_packages ${ALLDEPS} |
337 |
;; |
;; |
338 |
|
|
339 |
uppretend|srcuppretend) |
uppretend|srcuppretend) |
342 |
--pcat ${METHOD} \ |
--pcat ${METHOD} \ |
343 |
--pname ${METHOD} \ |
--pname ${METHOD} \ |
344 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
345 |
--pbuild ${METHOD} |
--pbuild ${METHOD} \ |
346 |
|
${depwalker_debug} |
347 |
;; |
;; |
348 |
|
|
349 |
upgrade|srcupgrade) |
upgrade) |
350 |
|
have_root_privileges || die "You must be root to run this operation." |
351 |
|
|
352 |
# get all dependencies of *all* installed packages |
# get all dependencies of *all* installed packages |
353 |
# fake pcat,pname,pver,pbuild ... |
# fake pcat,pname,pver,pbuild ... |
354 |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
356 |
--pcat ${METHOD} \ |
--pcat ${METHOD} \ |
357 |
--pname ${METHOD} \ |
--pname ${METHOD} \ |
358 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
359 |
--pbuild ${METHOD})" |
--pbuild ${METHOD} \ |
360 |
|
${depwalker_debug})" |
361 |
|
|
362 |
echo "DEBUG: ${ALLDEPS}" |
# first fetch all packages |
363 |
|
fetch_packages ${ALLDEPS} || die "fetching packages" |
364 |
|
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
365 |
|
install_packages ${ALLDEPS} || die "installing packages" |
366 |
|
;; |
367 |
|
|
368 |
|
srcupgrade) |
369 |
|
have_root_privileges || die "You must be root to run this operation." |
370 |
|
|
371 |
|
# get all dependencies of *all* installed packages |
372 |
|
# fake pcat,pname,pver,pbuild ... |
373 |
|
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
374 |
|
--method ${METHOD} \ |
375 |
|
--pcat ${METHOD} \ |
376 |
|
--pname ${METHOD} \ |
377 |
|
--pver ${METHOD} \ |
378 |
|
--pbuild ${METHOD} \ |
379 |
|
${depwalker_debug})" |
380 |
|
|
381 |
|
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
382 |
;; |
;; |
383 |
|
|
384 |
search) |
search) |
386 |
;; |
;; |
387 |
|
|
388 |
unpack) |
unpack) |
389 |
|
have_root_privileges || die "You must be root to run this operation." |
390 |
|
|
391 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
392 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
393 |
|
|
395 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
396 |
|
|
397 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
398 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
399 |
|
|
400 |
|
# package is masked |
401 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
402 |
|
|
403 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
404 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
412 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
413 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
414 |
--pver ${PVER} \ |
--pver ${PVER} \ |
415 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
416 |
|
${depwalker_debug})" |
417 |
|
|
418 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
419 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
420 |
unpack_packages ${ALLDEPS} || die "unpacking packages" |
unpack_packages ${ALLDEPS} || die "unpacking packages" |
421 |
;; |
;; |
422 |
|
|
423 |
update) |
update) |
424 |
|
have_root_privileges || die "You must be root to run this operation." |
425 |
syncmage |
syncmage |
426 |
;; |
;; |
427 |
|
|
428 |
|
update-tarball) |
429 |
|
have_root_privileges || die "You must be root to run this operation." |
430 |
|
syncmage_tarball |
431 |
|
;; |
432 |
|
|
433 |
clean) |
clean) |
434 |
|
have_root_privileges || die "You must be root to run this operation." |
435 |
cleanpkg |
cleanpkg |
436 |
;; |
;; |
437 |
|
|
438 |
version) |
version) |
439 |
showversion |
# showversion |
440 |
|
exit 0 |
441 |
;; |
;; |
442 |
|
|
443 |
regen-mage-tree) |
regen-mage-tree) |
444 |
|
have_root_privileges || die "You must be root to run this operation." |
445 |
|
|
446 |
if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] |
if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] |
447 |
then |
then |
448 |
echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos." |
echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos." |
454 |
done |
done |
455 |
;; |
;; |
456 |
|
|
457 |
|
print-features) |
458 |
|
mprintfeatures |
459 |
|
;; |
460 |
|
|
461 |
*) |
*) |
462 |
print_usage |
print_usage |
463 |
;; |
;; |