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.4 2005-09-09 18:05:45 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.17 2008-06-16 09:29:57 niro Exp $ |
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
7 |
{ |
{ |
8 |
|
echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} |
9 |
echo -e ${COLRED}"$@"${COLDEFAULT} |
echo -e ${COLRED}"$@"${COLDEFAULT} |
10 |
exit 1 |
exit 1 |
11 |
} |
} |
12 |
|
|
13 |
# include all needed files |
# include all needed files |
14 |
[ -f ${MLIBDIR}/conf/mage.rc.global ] && \ |
[ -f /etc/mage.rc.global ] && \ |
15 |
source ${MLIBDIR}/conf/mage.rc.global || \ |
source /etc/mage.rc.global || \ |
16 |
die "${MLIBDIR}/conf/mage.rc.global missing" |
die "/etc/mage.rc.global missing" |
17 |
|
|
18 |
[ -f /etc/mage.rc ] && source /etc/mage.rc || \ |
[ -f ${MAGERC} ] && source ${MAGERC} || \ |
19 |
die "Your /etc/mage.rc is missing. Aborting." |
die "Your ${MAGERC} is missing. Aborting." |
20 |
|
|
21 |
[ -f ${MLIBDIR}/mage.functions.sh ] && \ |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
22 |
source ${MLIBDIR}/mage.functions.sh || \ |
source ${MLIBDIR}/mage4.functions.sh || \ |
23 |
die "mage functions missing" |
die "mage functions missing" |
24 |
|
|
|
# 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 |
# export default path |
# export default path |
26 |
export PATH="${PATH}:${MLIBDIR}" |
export PATH="${PATH}:${MLIBDIR}" |
27 |
|
|
31 |
# sanity checks |
# sanity checks |
32 |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
33 |
|
|
34 |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]] |
35 |
then |
then |
36 |
echo |
echo |
37 |
echo "Please choose an profile from the mage tree." |
echo "Please choose an profile from the mage tree." |
40 |
fi |
fi |
41 |
|
|
42 |
# default messages |
# default messages |
43 |
showversion() { |
showversion() |
44 |
|
{ |
45 |
local MAGEVERSION="$(< ${MLIBDIR}/version)" |
local MAGEVERSION="$(< ${MLIBDIR}/version)" |
46 |
|
|
47 |
echo -en "Magellan Package Manager v${MAGEVERSION} " |
echo -en "Magellan Package Manager v${MAGEVERSION} " |
48 |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
49 |
} |
} |
50 |
|
|
51 |
print_usage(){ |
print_usage() |
52 |
showversion |
{ |
53 |
echo |
#showversion |
54 |
|
#echo |
55 |
echo "Usage: $(basename $0) [option] pkgname ..." |
echo "Usage: $(basename $0) [option] pkgname ..." |
56 |
echo "Options:" |
echo "Options:" |
57 |
echo " pretend - pretends dependencies of a package" |
echo " pretend - pretends dependencies of a package" |
58 |
echo " srcpretend - pretends dependencies of a package (build from source)" |
echo " srcpretend - pretends dependencies of a package (build from source)" |
59 |
echo " install - installs a package" |
echo " install - installs a package" |
60 |
echo " srcinstall - installs a package from source" |
echo " srcinstall - installs a package from source" |
61 |
echo " uninstall - removes a package" |
echo " uninstall - removes a package" |
62 |
echo " update - updates mage-tree" |
echo " update - updates the mage-tree via rsync" |
63 |
echo " uppretend - pretend dependencies for a system upgrade" |
echo " update-tarball - updates the mage-tree via a tarball" |
64 |
echo " upgrade - runs a complete system upgrade" |
echo " uppretend - pretend dependencies for a system upgrade" |
65 |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
echo " upgrade - runs a complete system upgrade" |
66 |
echo " srcupgrade - runs a complete system upgrade from source" |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
67 |
echo " search - searches mage-tree for a package" |
echo " srcupgrade - runs a complete system upgrade from source" |
68 |
echo " clean - removes *all* downloaded packages" |
echo " pretend-build-prerequisites" |
69 |
echo " unpack - unpacks *all* needed package for 'foo'" |
echo " install-build-prerequisites" |
70 |
echo " download - downloads *all* needed packages for 'foo'" |
echo " search - searches mage-tree for a package" |
71 |
echo " version - prints version info" |
echo " clean - removes *all* downloaded packages" |
72 |
|
echo " unpack - unpacks *all* needed package for 'foo'" |
73 |
|
echo " download - downloads *all* needed packages for 'foo'" |
74 |
|
echo " print-features - prints all enabled mage-features" |
75 |
|
echo " version - prints version info" |
76 |
|
echo " regen-mage-tree - regenerates the whole mage database (for devs only)" |
77 |
echo |
echo |
78 |
echo "Other options:" |
echo "Other options:" |
79 |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
80 |
# echo "Builds a Package with its dependencies, but won't install anything." |
# echo "Builds a Package with its dependencies, but won't install anything." |
81 |
# echo |
# echo |
82 |
echo "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE" |
echo "MAGE_DISTRIBUTION=unstable $(basename $0) [src]install PACKAGE" |
83 |
echo "Overrides stable packages; you can install packages that are marked unstable." |
echo "Overrides stable packages; you can install packages that are marked unstable." |
84 |
echo |
echo |
85 |
echo "USE_TESTING=true $(basename $0) [src]install PACKAGE" |
echo "MAGE_DISTRIBUTION=testing $(basename $0) [src]install PACKAGE" |
86 |
echo "Overrides stable packages; you can install packages that are marked testing." |
echo "Overrides stable packages; you can install packages that are marked testing." |
87 |
echo |
echo |
88 |
echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" |
echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" |
94 |
showversion |
showversion |
95 |
echo |
echo |
96 |
|
|
|
# before anything run mage_setup |
|
|
mage_setup || die "error in mage_setup()" |
|
|
|
|
97 |
# install method |
# install method |
98 |
METHOD="$1" |
METHOD="$1" |
99 |
|
|
100 |
# initial unversionized packagename, gets overridden later |
# initial unversionized packagename, gets overridden later on |
101 |
MAGENAME="$2" |
MAGENAME="$2" |
102 |
|
|
103 |
if [[ ${METHOD} != upgrade ]] && \ |
if [[ ${METHOD} != upgrade ]] && |
104 |
[[ ${METHOD} != srcupgrade ]] && \ |
[[ ${METHOD} != srcupgrade ]] && |
105 |
[[ ${METHOD} != uppretend ]] && \ |
[[ ${METHOD} != uppretend ]] && |
106 |
[[ ${METHOD} != srcuppretend ]] && \ |
[[ ${METHOD} != srcuppretend ]] && |
107 |
[[ ${METHOD} != update ]] && \ |
[[ ${METHOD} != update ]] && |
108 |
[[ ${METHOD} != clean ]] && \ |
[[ ${METHOD} != update-tarball ]] && |
109 |
[[ ${METHOD} != version ]] && \ |
[[ ${METHOD} != clean ]] && |
110 |
[[ ${METHOD} != search ]] && \ |
[[ ${METHOD} != version ]] && |
111 |
[[ ${METHOD} != regen-mage-tree ]] |
[[ ${METHOD} != search ]] && |
112 |
|
[[ ${METHOD} != regen-mage-tree ]] && |
113 |
|
[[ ${METHOD} != print-features ]] |
114 |
then |
then |
115 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
116 |
fi |
fi |
117 |
|
|
118 |
|
# set PKGDIR and BUILDDIR to MROOT |
119 |
|
if [[ -n ${MROOT} ]] |
120 |
|
then |
121 |
|
PKGDIR=${MROOT}/${PKGDIR} |
122 |
|
BUILDDIR=${MROOT}/${BUILDDIR} |
123 |
|
fi |
124 |
|
|
125 |
|
# before anything run mage_setup |
126 |
|
mage_setup || die "error in mage_setup()" |
127 |
|
|
128 |
|
# load supported mage features |
129 |
|
load_mage_features |
130 |
|
|
131 |
|
# query debug mode |
132 |
|
if mqueryfeature "debug" |
133 |
|
then |
134 |
|
depwalker_debug="--debug" |
135 |
|
else |
136 |
|
depwalker_debug="" |
137 |
|
fi |
138 |
|
|
139 |
case ${METHOD} in |
case ${METHOD} in |
140 |
download) |
download) |
145 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
146 |
|
|
147 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
148 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
149 |
|
|
150 |
|
# package is masked |
151 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
152 |
|
|
153 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
154 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
162 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
163 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
164 |
--pver ${PVER} \ |
--pver ${PVER} \ |
165 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
166 |
|
${depwalker_debug})" |
167 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
168 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
169 |
;; |
;; |
176 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
177 |
|
|
178 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
179 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
180 |
|
|
181 |
|
# package is masked |
182 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
183 |
|
|
184 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
185 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
193 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
194 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
195 |
--pver ${PVER} \ |
--pver ${PVER} \ |
196 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
197 |
|
${depwalker_debug})" |
198 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
199 |
;; |
;; |
200 |
|
|
201 |
pretend|srcpretend) |
pretend|srcpretend|pretend-build-prerequisites) |
202 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
203 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
204 |
|
|
206 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
207 |
|
|
208 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
209 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
210 |
|
|
211 |
|
# package is masked |
212 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
213 |
|
|
214 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
215 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
231 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
232 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
233 |
--pver ${PVER} \ |
--pver ${PVER} \ |
234 |
--pbuild ${PBUILD} |
--pbuild ${PBUILD} \ |
235 |
|
${depwalker_debug} |
236 |
;; |
;; |
237 |
|
|
238 |
install) |
install|install-build-prerequisites) |
239 |
|
have_root_privileges || die "You must be root to run this operation." |
240 |
|
|
241 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
242 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
243 |
|
|
245 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
246 |
|
|
247 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
248 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
249 |
|
|
250 |
|
# package is masked |
251 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
252 |
|
|
253 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
254 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
259 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
260 |
then |
then |
261 |
echo -en "Package " |
echo -en "Package " |
262 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
263 |
echo -e " already installed." |
echo -e " already installed." |
264 |
exit 3 |
exit 3 |
265 |
fi |
fi |
270 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
271 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
272 |
--pver ${PVER} \ |
--pver ${PVER} \ |
273 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
274 |
|
${depwalker_debug})" |
275 |
|
|
276 |
# first fetch all packages |
# first fetch all packages |
277 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
278 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
|
unpack_packages ${ALLDEPS} || die "unpacking packages" |
|
279 |
install_packages ${ALLDEPS} || die "installing packages" |
install_packages ${ALLDEPS} || die "installing packages" |
280 |
;; |
;; |
281 |
|
|
282 |
srcinstall) |
srcinstall) |
283 |
|
have_root_privileges || die "You must be root to run this operation." |
284 |
|
|
285 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
286 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
287 |
|
|
289 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
290 |
|
|
291 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
292 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
293 |
|
|
294 |
|
# package is masked |
295 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
296 |
|
|
297 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
298 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
303 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
304 |
then |
then |
305 |
echo -en "Package " |
echo -en "Package " |
306 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
307 |
echo -e " already installed." |
echo -e " already installed." |
308 |
exit 3 |
exit 3 |
309 |
fi |
fi |
314 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
315 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
316 |
--pver ${PVER} \ |
--pver ${PVER} \ |
317 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
318 |
|
${depwalker_debug})" |
319 |
|
|
320 |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
321 |
;; |
;; |
322 |
|
|
323 |
uninstall) |
uninstall) |
324 |
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
have_root_privileges || die "You must be root to run this operation." |
325 |
if [ -z "${ALLDEPS}" ] |
|
326 |
then |
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
327 |
die "No package installed named '${MAGENAME}'." |
if [ -z "${ALLDEPS}" ] |
328 |
fi |
then |
329 |
uninstall_packages ${ALLDEPS} |
die "No package installed named '${MAGENAME}'." |
330 |
|
fi |
331 |
|
uninstall_packages ${ALLDEPS} |
332 |
;; |
;; |
333 |
|
|
334 |
uppretend|srcuppretend) |
uppretend|srcuppretend) |
337 |
--pcat ${METHOD} \ |
--pcat ${METHOD} \ |
338 |
--pname ${METHOD} \ |
--pname ${METHOD} \ |
339 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
340 |
--pbuild ${METHOD} |
--pbuild ${METHOD} \ |
341 |
|
${depwalker_debug} |
342 |
|
;; |
343 |
|
|
344 |
|
upgrade) |
345 |
|
have_root_privileges || die "You must be root to run this operation." |
346 |
|
|
347 |
|
# get all dependencies of *all* installed packages |
348 |
|
# fake pcat,pname,pver,pbuild ... |
349 |
|
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
350 |
|
--method ${METHOD} \ |
351 |
|
--pcat ${METHOD} \ |
352 |
|
--pname ${METHOD} \ |
353 |
|
--pver ${METHOD} \ |
354 |
|
--pbuild ${METHOD} \ |
355 |
|
${depwalker_debug})" |
356 |
|
|
357 |
|
# first fetch all packages |
358 |
|
fetch_packages ${ALLDEPS} || die "fetching packages" |
359 |
|
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
360 |
|
install_packages ${ALLDEPS} || die "installing packages" |
361 |
;; |
;; |
362 |
|
|
363 |
upgrade|srcupgrade) |
srcupgrade) |
364 |
|
have_root_privileges || die "You must be root to run this operation." |
365 |
|
|
366 |
# get all dependencies of *all* installed packages |
# get all dependencies of *all* installed packages |
367 |
# fake pcat,pname,pver,pbuild ... |
# fake pcat,pname,pver,pbuild ... |
368 |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
370 |
--pcat ${METHOD} \ |
--pcat ${METHOD} \ |
371 |
--pname ${METHOD} \ |
--pname ${METHOD} \ |
372 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
373 |
--pbuild ${METHOD})" |
--pbuild ${METHOD} \ |
374 |
|
${depwalker_debug})" |
375 |
|
|
376 |
echo "DEBUG: ${ALLDEPS}" |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
377 |
;; |
;; |
378 |
|
|
379 |
search) |
search) |
380 |
${MLIBDIR}/pkgsearch.sh ${MAGENAME} |
pkgsearch "${MAGENAME}" |
381 |
;; |
;; |
382 |
|
|
383 |
unpack) |
unpack) |
384 |
|
have_root_privileges || die "You must be root to run this operation." |
385 |
|
|
386 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
387 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
388 |
|
|
390 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
391 |
|
|
392 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
393 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
394 |
|
|
395 |
|
# package is masked |
396 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
397 |
|
|
398 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
399 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
407 |
--pcat ${PCAT} \ |
--pcat ${PCAT} \ |
408 |
--pname ${PNAME} \ |
--pname ${PNAME} \ |
409 |
--pver ${PVER} \ |
--pver ${PVER} \ |
410 |
--pbuild ${PBUILD})" |
--pbuild ${PBUILD} \ |
411 |
|
${depwalker_debug})" |
412 |
|
|
413 |
fetch_packages ${ALLDEPS} || die "fetching packages" |
fetch_packages ${ALLDEPS} || die "fetching packages" |
414 |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
415 |
unpack_packages ${ALLDEPS} || die "unpacking packages" |
unpack_packages ${ALLDEPS} || die "unpacking packages" |
416 |
;; |
;; |
417 |
|
|
418 |
update) |
update) |
419 |
|
have_root_privileges || die "You must be root to run this operation." |
420 |
syncmage |
syncmage |
421 |
;; |
;; |
422 |
|
|
423 |
|
update-tarball) |
424 |
|
have_root_privileges || die "You must be root to run this operation." |
425 |
|
syncmage_tarball |
426 |
|
;; |
427 |
|
|
428 |
clean) |
clean) |
429 |
|
have_root_privileges || die "You must be root to run this operation." |
430 |
cleanpkg |
cleanpkg |
431 |
;; |
;; |
432 |
|
|
433 |
version) |
version) |
434 |
showversion |
# showversion |
435 |
|
exit 0 |
436 |
;; |
;; |
437 |
|
|
438 |
regen-mage-tree) |
regen-mage-tree) |
439 |
|
have_root_privileges || die "You must be root to run this operation." |
440 |
|
|
441 |
if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] |
if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] |
442 |
then |
then |
443 |
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." |
449 |
done |
done |
450 |
;; |
;; |
451 |
|
|
452 |
|
print-features) |
453 |
|
mprintfeatures |
454 |
|
;; |
455 |
|
|
456 |
*) |
*) |
457 |
print_usage |
print_usage |
458 |
;; |
;; |