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.2 2005-09-09 17:49:43 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 |
} |
} |
13 |
|
|
14 |
# include all needed files |
# include all needed files |
15 |
# [ -f ${MLIBDIR}/conf/mage.rc.global ] && \ |
[ -f /etc/mage.rc.global ] && \ |
16 |
# source ${MLIBDIR}/conf/mage.rc.global || \ |
source /etc/mage.rc.global || \ |
17 |
# die "${MLIBDIR}/conf/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}/mage.functions.sh ] && \ |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
23 |
# source ${MLIBDIR}/mage.functions.sh || \ |
source ${MLIBDIR}/mage4.functions.sh || \ |
24 |
# die "mage functions missing" |
die "mage functions missing" |
|
|
|
|
# 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" |
|
|
COLBLUE="\033[1;6m\033[34m" |
|
|
COLDEFAULT="\033[0m" |
|
|
|
|
|
if [[ ${NOCOLORS} = true ]] |
|
|
then |
|
|
COLRED="" |
|
|
COLGREEN="" |
|
|
COLYELLOW="" |
|
|
COLBLUE="" |
|
|
COLMAGENTA="" |
|
|
COLWHITE="" |
|
|
COLDEFAULT="" |
|
|
fi |
|
25 |
|
|
26 |
# export default path |
# export default path |
27 |
export PATH="${PATH}:${MLIBDIR}" |
export PATH="${PATH}:${MLIBDIR}" |
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} ] && |
36 |
|
[[ $1 != update ]] && |
37 |
|
[[ $1 != update-rsync ]] && |
38 |
|
[[ $1 != update-tarball ]] |
39 |
then |
then |
40 |
echo |
echo |
41 |
echo "Please choose an profile from the mage tree." |
echo "Please choose an profile from the mage tree." |
44 |
fi |
fi |
45 |
|
|
46 |
# default messages |
# default messages |
47 |
showversion() { |
showversion() |
48 |
|
{ |
49 |
local MAGEVERSION="$(< ${MLIBDIR}/version)" |
local MAGEVERSION="$(< ${MLIBDIR}/version)" |
50 |
|
|
51 |
echo -en "Magellan Package Manager v${MAGEVERSION} " |
echo -en "Magellan Package Manager v${MAGEVERSION} " |
52 |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
53 |
} |
} |
54 |
|
|
55 |
print_usage(){ |
print_usage() |
56 |
showversion |
{ |
57 |
echo |
#showversion |
58 |
|
#echo |
59 |
echo "Usage: $(basename $0) [option] pkgname ..." |
echo "Usage: $(basename $0) [option] pkgname ..." |
60 |
echo "Options:" |
echo "Options:" |
61 |
echo " pretend - pretends dependencies of a package" |
echo " pretend - pretends dependencies of a package" |
62 |
echo " srcpretend - pretends dependencies of a package (build from source)" |
echo " srcpretend - pretends dependencies of a package (build from source)" |
63 |
echo " install - installs a package" |
echo " install - installs a package" |
64 |
echo " srcinstall - installs a package from source" |
echo " srcinstall - installs a package from source" |
65 |
echo " uninstall - removes a package" |
echo " uninstall - removes a package" |
66 |
echo " update - updates mage-tree" |
echo " update - updates the mage-tree via default sync method" |
67 |
echo " uppretend - pretend dependencies for a system upgrade" |
echo " update-rsync - updates the mage-tree via rsync" |
68 |
echo " upgrade - runs a complete system upgrade" |
echo " update-tarball - updates the mage-tree via a tarball" |
69 |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
echo " uppretend - pretend dependencies for a system upgrade" |
70 |
echo " srcupgrade - runs a complete system upgrade from source" |
echo " upgrade - runs a complete system upgrade" |
71 |
echo " search - searches mage-tree for a package" |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
72 |
echo " clean - removes *all* downloaded packages" |
echo " srcupgrade - runs a complete system upgrade from source" |
73 |
echo " unpack - unpacks *all* needed package for 'foo'" |
echo " pretend-build-prerequisites - prints build prerequisites" |
74 |
echo " download - downloads *all* needed packages for 'foo'" |
echo " install-build-prerequisites - install build prerequisites" |
75 |
echo " version - prints version info" |
echo " search - searches mage-tree for a package" |
76 |
|
echo " clean - removes *all* downloaded packages" |
77 |
|
echo " unpack - unpacks *all* needed package for 'foo'" |
78 |
|
echo " download - downloads *all* needed packages for 'foo'" |
79 |
|
echo " print-features - prints all enabled mage-features" |
80 |
|
echo " version - prints version info" |
81 |
|
echo " regen-mage-tree - regenerates the whole mage database (for devs only)" |
82 |
echo |
echo |
83 |
echo "Other options:" |
echo "Other options:" |
84 |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
85 |
# echo "Builds a Package with its dependencies, but won't install anything." |
# echo "Builds a Package with its dependencies, but won't install anything." |
86 |
# echo |
# echo |
87 |
echo "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE" |
echo "MAGE_DISTRIBUTION=unstable $(basename $0) [src]install PACKAGE" |
88 |
echo "Overrides stable packages; you can install packages that are marked unstable." |
echo "Overrides stable packages; you can install packages that are marked unstable." |
89 |
echo |
echo |
90 |
echo "USE_TESTING=true $(basename $0) [src]install PACKAGE" |
echo "MAGE_DISTRIBUTION=testing $(basename $0) [src]install PACKAGE" |
91 |
echo "Overrides stable packages; you can install packages that are marked testing." |
echo "Overrides stable packages; you can install packages that are marked testing." |
92 |
echo |
echo |
93 |
echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" |
echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" |
99 |
showversion |
showversion |
100 |
echo |
echo |
101 |
|
|
|
# before anything run mage_setup |
|
|
mage_setup || die "error in mage_setup()" |
|
|
|
|
102 |
# install method |
# install method |
103 |
METHOD="$1" |
METHOD="$1" |
104 |
|
|
105 |
# initial unversionized packagename, gets overridden later |
# initial unversionized packagename, gets overridden later on |
106 |
MAGENAME="$2" |
MAGENAME="$2" |
107 |
|
|
108 |
if [[ ${METHOD} != upgrade ]] && \ |
if [[ ${METHOD} != upgrade ]] && |
109 |
[[ ${METHOD} != srcupgrade ]] && \ |
[[ ${METHOD} != srcupgrade ]] && |
110 |
[[ ${METHOD} != uppretend ]] && \ |
[[ ${METHOD} != uppretend ]] && |
111 |
[[ ${METHOD} != srcuppretend ]] |
[[ ${METHOD} != srcuppretend ]] && |
112 |
|
[[ ${METHOD} != update ]] && |
113 |
|
[[ ${METHOD} != update-rsync ]] && |
114 |
|
[[ ${METHOD} != update-tarball ]] && |
115 |
|
[[ ${METHOD} != clean ]] && |
116 |
|
[[ ${METHOD} != version ]] && |
117 |
|
[[ ${METHOD} != search ]] && |
118 |
|
[[ ${METHOD} != regen-mage-tree ]] && |
119 |
|
[[ ${METHOD} != print-features ]] |
120 |
then |
then |
121 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
122 |
fi |
fi |
123 |
|
|
124 |
|
# set PKGDIR and BUILDDIR to MROOT |
125 |
|
if [[ -n ${MROOT} ]] |
126 |
|
then |
127 |
|
PKGDIR=${MROOT}/${PKGDIR} |
128 |
|
BUILDDIR=${MROOT}/${BUILDDIR} |
129 |
|
fi |
130 |
|
|
131 |
|
# before anything run mage_setup |
132 |
|
mage_setup || die "error in mage_setup()" |
133 |
|
|
134 |
|
# load supported mage features |
135 |
|
load_mage_features |
136 |
|
|
137 |
|
# query debug mode |
138 |
|
if mqueryfeature "debug" |
139 |
|
then |
140 |
|
depwalker_debug="--debug" |
141 |
|
else |
142 |
|
depwalker_debug="" |
143 |
|
fi |
144 |
|
|
145 |
case ${METHOD} in |
case ${METHOD} in |
146 |
download) |
download) |
147 |
|
have_root_privileges || die "You must be root to run this operation." |
148 |
|
|
149 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
150 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
151 |
|
|
153 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
154 |
|
|
155 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
156 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
157 |
|
|
158 |
|
# package is masked |
159 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
160 |
|
|
161 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
162 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
170 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
171 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
172 |
--pver ${PVER} \ |
--pver ${PVER} \ |
173 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
174 |
|
${depwalker_debug})" |
175 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
176 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
177 |
;; |
;; |
178 |
|
|
179 |
srcdownload) |
srcdownload) |
180 |
|
have_root_privileges || die "You must be root to run this operation." |
181 |
|
|
182 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
183 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
184 |
|
|
186 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
187 |
|
|
188 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
189 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
190 |
|
|
191 |
|
# package is masked |
192 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
193 |
|
|
194 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
195 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
203 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
204 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
205 |
--pver ${PVER} \ |
--pver ${PVER} \ |
206 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
207 |
|
${depwalker_debug})" |
208 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
209 |
;; |
;; |
210 |
|
|
211 |
pretend|srcpretend) |
pretend|srcpretend|pretend-build-prerequisites) |
212 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
213 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
214 |
|
|
216 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
217 |
|
|
218 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
219 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
220 |
|
|
221 |
|
# package is masked |
222 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
223 |
|
|
224 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
225 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
241 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
242 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
243 |
--pver ${PVER} \ |
--pver ${PVER} \ |
244 |
--pbuild ${PBUILD} |
--pbuild ${PBUILD} \ |
245 |
|
${depwalker_debug} |
246 |
;; |
;; |
247 |
|
|
248 |
install) |
install|install-build-prerequisites) |
249 |
|
have_root_privileges || die "You must be root to run this operation." |
250 |
|
|
251 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
252 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
253 |
|
|
255 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
256 |
|
|
257 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
258 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
259 |
|
|
260 |
|
# package is masked |
261 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
262 |
|
|
263 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
264 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
269 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
270 |
then |
then |
271 |
echo -en "Package " |
echo -en "Package " |
272 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
273 |
echo -e " already installed." |
echo -e " already installed." |
274 |
exit 3 |
exit 3 |
275 |
fi |
fi |
280 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
281 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
282 |
--pver ${PVER} \ |
--pver ${PVER} \ |
283 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
284 |
|
${depwalker_debug})" |
285 |
|
|
286 |
# first fetch all packages |
# first fetch all packages |
287 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
288 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
|
unpack_packages ${ALLDEPS} || die "unpacking packages" |
|
289 |
install_packages ${ALLDEPS} || die "installing packages" |
install_packages ${ALLDEPS} || die "installing packages" |
290 |
;; |
;; |
291 |
|
|
292 |
srcinstall) |
srcinstall) |
293 |
|
have_root_privileges || die "You must be root to run this operation." |
294 |
|
|
295 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
296 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
297 |
|
|
299 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
300 |
|
|
301 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
302 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
303 |
|
|
304 |
|
# package is masked |
305 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
306 |
|
|
307 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
308 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
313 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
314 |
then |
then |
315 |
echo -en "Package " |
echo -en "Package " |
316 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
317 |
echo -e " already installed." |
echo -e " already installed." |
318 |
exit 3 |
exit 3 |
319 |
fi |
fi |
324 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
325 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
326 |
--pver ${PVER} \ |
--pver ${PVER} \ |
327 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
328 |
|
${depwalker_debug})" |
329 |
|
|
330 |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
331 |
;; |
;; |
332 |
|
|
333 |
uninstall) |
uninstall) |
334 |
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
have_root_privileges || die "You must be root to run this operation." |
335 |
if [ -z "${ALLDEPS}" ] |
|
336 |
then |
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
337 |
die "No package installed named '${MAGENAME}'." |
if [ -z "${ALLDEPS}" ] |
338 |
fi |
then |
339 |
uninstall_packages ${ALLDEPS} |
die "No package installed named '${MAGENAME}'." |
340 |
|
fi |
341 |
|
uninstall_packages ${ALLDEPS} |
342 |
;; |
;; |
343 |
|
|
344 |
uppretend|srcuppretend) |
uppretend|srcuppretend) |
347 |
--pcat ${METHOD} \ |
--pcat ${METHOD} \ |
348 |
--pname ${METHOD} \ |
--pname ${METHOD} \ |
349 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
350 |
--pbuild ${METHOD} |
--pbuild ${METHOD} \ |
351 |
|
${depwalker_debug} |
352 |
|
;; |
353 |
|
|
354 |
|
upgrade) |
355 |
|
have_root_privileges || die "You must be root to run this operation." |
356 |
|
|
357 |
|
# get all dependencies of *all* installed packages |
358 |
|
# fake pcat,pname,pver,pbuild ... |
359 |
|
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
360 |
|
--method ${METHOD} \ |
361 |
|
--pcat ${METHOD} \ |
362 |
|
--pname ${METHOD} \ |
363 |
|
--pver ${METHOD} \ |
364 |
|
--pbuild ${METHOD} \ |
365 |
|
${depwalker_debug})" |
366 |
|
|
367 |
|
# first fetch all packages |
368 |
|
fetch_packages ${ALLDEPS} || die "fetching packages" |
369 |
|
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
370 |
|
install_packages ${ALLDEPS} || die "installing packages" |
371 |
;; |
;; |
372 |
|
|
373 |
upgrade|srcupgrade) |
srcupgrade) |
374 |
|
have_root_privileges || die "You must be root to run this operation." |
375 |
|
|
376 |
# get all dependencies of *all* installed packages |
# get all dependencies of *all* installed packages |
377 |
# fake pcat,pname,pver,pbuild ... |
# fake pcat,pname,pver,pbuild ... |
378 |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
380 |
--pcat ${METHOD} \ |
--pcat ${METHOD} \ |
381 |
--pname ${METHOD} \ |
--pname ${METHOD} \ |
382 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
383 |
--pbuild ${METHOD})" |
--pbuild ${METHOD} \ |
384 |
|
${depwalker_debug})" |
385 |
|
|
386 |
echo "DEBUG: ${ALLDEPS}" |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
387 |
;; |
;; |
388 |
|
|
389 |
search) |
search) |
390 |
${MLIBDIR}/pkgsearch.sh ${MAGENAME} |
pkgsearch "${MAGENAME}" |
391 |
;; |
;; |
392 |
|
|
393 |
unpack) |
unpack) |
394 |
|
have_root_privileges || die "You must be root to run this operation." |
395 |
|
|
396 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
397 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
398 |
|
|
400 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
401 |
|
|
402 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
403 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
404 |
|
|
405 |
|
# package is masked |
406 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
407 |
|
|
408 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
409 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
417 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
418 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
419 |
--pver ${PVER} \ |
--pver ${PVER} \ |
420 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
421 |
|
${depwalker_debug})" |
422 |
|
|
423 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
424 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
425 |
unpack_packages ${ALLDEPS} || die "unpacking packages" |
unpack_packages ${ALLDEPS} || die "unpacking packages" |
426 |
;; |
;; |
427 |
|
|
428 |
update) |
update) |
429 |
|
have_root_privileges || die "You must be root to run this operation." |
430 |
|
# default to tarball |
431 |
|
[[ -z ${MAGE_UPDATE_METHOD} ]] && MAGE_UPDATE_METHOD="tarball" |
432 |
|
case ${MAGE_UPDATE_METHOD} in |
433 |
|
rsync) syncmage ;; |
434 |
|
tarball) syncmage_tarball ;; |
435 |
|
*) die "Unknown MAGE_UPDATE_METHOD defined." ;; |
436 |
|
esac |
437 |
|
;; |
438 |
|
|
439 |
|
update-rsync) |
440 |
|
have_root_privileges || die "You must be root to run this operation." |
441 |
syncmage |
syncmage |
442 |
;; |
;; |
443 |
|
|
444 |
|
update-tarball) |
445 |
|
have_root_privileges || die "You must be root to run this operation." |
446 |
|
syncmage_tarball |
447 |
|
;; |
448 |
|
|
449 |
clean) |
clean) |
450 |
|
have_root_privileges || die "You must be root to run this operation." |
451 |
cleanpkg |
cleanpkg |
452 |
;; |
;; |
453 |
|
|
454 |
version) |
version) |
455 |
showversion |
# showversion |
456 |
|
exit 0 |
457 |
;; |
;; |
458 |
|
|
459 |
regen-mage-tree) |
regen-mage-tree) |
460 |
|
have_root_privileges || die "You must be root to run this operation." |
461 |
|
|
462 |
if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] |
if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] |
463 |
then |
then |
464 |
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." |
470 |
done |
done |
471 |
;; |
;; |
472 |
|
|
473 |
|
print-features) |
474 |
|
mprintfeatures |
475 |
|
;; |
476 |
|
|
477 |
*) |
*) |
478 |
print_usage |
print_usage |
479 |
;; |
;; |