66 |
case ${method} in |
case ${method} in |
67 |
md5) cmd="md5sum" ;; |
md5) cmd="md5sum" ;; |
68 |
sha256) cmd="sha256sum" ;; |
sha256) cmd="sha256sum" ;; |
69 |
*) die "mchecksum(): unkown method '${method}'" ;; |
*) die "mchecksum(): unknown method '${method}'" ;; |
70 |
esac |
esac |
71 |
|
|
72 |
if [[ -d ${rundir} ]] |
if [[ -d ${rundir} ]] |
73 |
then |
then |
74 |
pushd ${rundir} &> /dev/null |
pushd ${rundir} &> /dev/null |
75 |
${cmd} -c ${file} &> /dev/null |
# be verbose here |
76 |
|
${cmd} -c ${file} #&> /dev/null |
77 |
retval="$?" |
retval="$?" |
78 |
popd &> /dev/null |
popd &> /dev/null |
79 |
else |
else |
83 |
return "${retval}" |
return "${retval}" |
84 |
} |
} |
85 |
|
|
86 |
|
mcheckemptydir() |
87 |
|
{ |
88 |
|
local dir="$1" |
89 |
|
local retval=1 |
90 |
|
|
91 |
|
if [[ ! -d ${dir} ]] |
92 |
|
then |
93 |
|
echo "mcheckemptydir(): '${dir}' is not a directory!" |
94 |
|
retval=3 |
95 |
|
else |
96 |
|
shopt -s nullglob dotglob |
97 |
|
files=( ${dir}/* ) |
98 |
|
(( ${#files[*]} )) || retval=0 |
99 |
|
shopt -u nullglob dotglob |
100 |
|
fi |
101 |
|
|
102 |
|
return ${retval} |
103 |
|
} |
104 |
|
|
105 |
unpack_packages() |
unpack_packages() |
106 |
{ |
{ |
107 |
local list="$@" |
local list="$@" |
171 |
mtime=$(stat -c %Y "${reference}") |
mtime=$(stat -c %Y "${reference}") |
172 |
touch \ |
touch \ |
173 |
--no-create \ |
--no-create \ |
174 |
|
--no-dereference \ |
175 |
--time=mtime \ |
--time=mtime \ |
176 |
--reference "${reference}" \ |
--reference="${reference}" \ |
177 |
"${pathto}" |
"${pathto}" |
178 |
|
|
179 |
echo "${mtime}" |
echo "${mtime}" |
415 |
|
|
416 |
ln -snf "${link}" "${MROOT}${pathto}" |
ln -snf "${link}" "${MROOT}${pathto}" |
417 |
|
|
418 |
# # fix mtime and db |
# fix mtime and db |
419 |
# fix_descriptor ${pkgname}/.symlinks \ |
fix_descriptor ${pkgname}/.symlinks \ |
420 |
# "${pathto}" \ |
"${pathto}" \ |
421 |
# "${posix}" \ |
"${posix}" \ |
422 |
# "${link}" \ |
"${link}" \ |
423 |
# "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \ |
"$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \ |
424 |
# "${MROOT}${pathto}")" |
"${MROOT}${pathto}")" |
425 |
|
|
426 |
done < ${BUILDDIR}/${pkgname}/.symlinks |
done < ${BUILDDIR}/${pkgname}/.symlinks |
427 |
|
|
808 |
|
|
809 |
mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)" |
mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)" |
810 |
|
|
811 |
# if $pathto is a symlink than compare linked binary |
# no extra handlink for symlinks anymore as fix_mtime |
812 |
if [ -L "${MROOT}${pathto}" ] |
# uses --no-dereference, compare directly |
813 |
then |
x=$(stat -c %Y "${MROOT}${pathto}") |
|
# readlink -f resolves full path of linked file |
|
|
x="$(readlink -f "${MROOT}${pathto}")" |
|
|
|
|
|
# abort if target does not exists |
|
|
# we keep safe here, theoretically the link can removed |
|
|
[ ! -e "${x}" ] && return 1 |
|
|
|
|
|
x=$(stat -c %Y "${x}") |
|
|
else |
|
|
x=$(stat -c %Y "${MROOT}${pathto}") |
|
|
fi |
|
814 |
|
|
815 |
[[ ${mtime} = ${x} ]] && return 0 |
[[ ${mtime} = ${x} ]] && return 0 |
816 |
|
|
1411 |
real_uris="$(convertmirrors ${uri})" |
real_uris="$(convertmirrors ${uri})" |
1412 |
|
|
1413 |
# verbose or not |
# verbose or not |
1414 |
mqueryfeature "!verbose" && wget_opts="--quiet" |
mqueryfeature "!verbose" && wget_opts+=" --quiet" |
1415 |
|
|
1416 |
# filter wget options if busybox was found |
# filter wget options if busybox was found |
1417 |
wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
wget_opts+=" $(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
1418 |
|
|
1419 |
# create outputdir |
# create outputdir |
1420 |
[[ ! -d ${outputdir} ]] && install -d "${outputdir}" |
[[ ! -d ${outputdir} ]] && install -d "${outputdir}" |
1555 |
|
|
1556 |
for mirr in ${MIRRORS} |
for mirr in ${MIRRORS} |
1557 |
do |
do |
1558 |
# path without distribution |
# path without distribution |
1559 |
mymirr="${mirr%/*}" |
# (only for stable|testing|unstable and not DISTROTAG) |
1560 |
|
case ${mirr##*/} in |
1561 |
|
stable|testing|unstable) mymirr="${mirr%/*}";; |
1562 |
|
*) mymirr="${mirr}";; |
1563 |
|
esac |
1564 |
|
|
1565 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1566 |
echo "fetching latest md5 from ${mymirr} ..." |
echo "fetching latest md5 from ${mymirr} ..." |
1593 |
else |
else |
1594 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1595 |
echo -n "checking md5sum... " |
echo -n "checking md5sum... " |
1596 |
( cd ${temp}; md5sum -c ${latest_md5} ) || die "md5 for ${latest_tarball} failed" |
mchecksum --rundir "${temp}" --file "${latest_md5}" --method md5 || die "md5 for ${latest_tarball} failed" |
1597 |
fi |
fi |
1598 |
|
|
1599 |
if [[ -d ${MAGEDIR} ]] |
if [[ -d ${MAGEDIR} ]] |
1600 |
then |
then |
1601 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1602 |
echo "cleaning old mage-tree ${MAGEDIR}..." |
echo "cleaning old mage-tree ${MAGEDIR}..." |
1603 |
rm -rf ${MAGEDIR} |
# honor mountpoints and empty dirs |
1604 |
|
if mountpoint -q ${MAGEDIR} |
1605 |
|
then |
1606 |
|
if ! mcheckemptydir ${MAGEDIR} |
1607 |
|
then |
1608 |
|
find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r |
1609 |
|
fi |
1610 |
|
else |
1611 |
|
rm -rf ${MAGEDIR} |
1612 |
|
fi |
1613 |
fi |
fi |
1614 |
|
|
1615 |
if need_busybox_support tar |
if need_busybox_support tar |
1668 |
} |
} |
1669 |
|
|
1670 |
|
|
1671 |
# cuts full pathnames or versionized names down to basename |
# unused? |
1672 |
choppkgname() |
# |
1673 |
{ |
# # cuts full pathnames or versionized names down to basename |
1674 |
#we want this only if full name was used |
# choppkgname() |
1675 |
if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] |
# { |
1676 |
then |
# #we want this only if full name was used |
1677 |
#cuts ARCH and PBUILD |
# if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] |
1678 |
#ARCH comes from ${MAGERC} |
# then |
1679 |
MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") |
# #cuts ARCH and PBUILD |
1680 |
|
# #ARCH comes from ${MAGERC} |
1681 |
|
# MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}$(print_distrotag)-r*.::g") |
1682 |
|
# |
1683 |
|
# #cuts version number |
1684 |
|
# MAGENAME=$(basename ${MAGENAME%-*} .mage) |
1685 |
|
# fi |
1686 |
|
# } |
1687 |
|
|
|
#cuts version number |
|
|
MAGENAME=$(basename ${MAGENAME%-*} .mage) |
|
|
fi |
|
|
} |
|
1688 |
|
|
1689 |
# get_categorie $PNAME, returns CATEGORIE |
# get_categorie $PNAME, returns CATEGORIE |
1690 |
# $1=pname |
# $1=pname |
2785 |
then |
then |
2786 |
echo -ne "${COLBLUE} *** ${COLDEFAULT}" |
echo -ne "${COLBLUE} *** ${COLDEFAULT}" |
2787 |
echo -ne "checking md5sum (${count_current}/${count_total}): " |
echo -ne "checking md5sum (${count_current}/${count_total}): " |
2788 |
( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed" |
mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 || die "md5 for ${pkgfile} failed" |
2789 |
else |
else |
2790 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
2791 |
echo -e "!! no md5sum file found for ${pkgfile} :(" |
echo -e "!! no md5sum file found for ${pkgfile} :(" |
3025 |
local state |
local state |
3026 |
local descriptiom |
local descriptiom |
3027 |
local homepage |
local homepage |
3028 |
|
local license |
3029 |
local i |
local i |
3030 |
local all_installed |
local all_installed |
3031 |
local ipver |
local ipver |
3062 |
state="$(get_value_from_magefile STATE ${magefile})" |
state="$(get_value_from_magefile STATE ${magefile})" |
3063 |
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
3064 |
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
3065 |
|
license="$(get_value_from_magefile LICENSE ${magefile})" |
3066 |
|
|
3067 |
# all installed |
# all installed |
3068 |
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
3069 |
do |
do |
3070 |
ipver="$(magename2pver ${i})" |
ipver="$(magename2pver ${i})" |
3071 |
ipbuild="$(magename2pbuild ${i})" |
ipbuild="$(magename2pbuild ${i})" |
3072 |
|
|
3073 |
if [[ -z ${all_installed} ]] |
if [[ -z ${all_installed} ]] |
3074 |
then |
then |
3075 |
all_installed="${ipver}-${ipbuild}" |
all_installed="${ipver}-${ipbuild}" |
3078 |
fi |
fi |
3079 |
done |
done |
3080 |
[[ -z ${all_installed} ]] && all_installed="none" |
[[ -z ${all_installed} ]] && all_installed="none" |
3081 |
|
|
3082 |
case ${state} in |
case ${state} in |
3083 |
stable) state=${COLGREEN}"[s] ";; |
stable) state=${COLGREEN}"[s] ";; |
3084 |
testing) state=${COLYELLOW}"[t] ";; |
testing) state=${COLYELLOW}"[t] ";; |
3123 |
echo " Installed versions: ${all_installed}" |
echo " Installed versions: ${all_installed}" |
3124 |
echo " Description: ${description}" |
echo " Description: ${description}" |
3125 |
echo " Homepage: ${homepage}" |
echo " Homepage: ${homepage}" |
3126 |
|
if [[ ! -z ${license} ]] |
3127 |
|
then |
3128 |
|
echo " License: ${license}" |
3129 |
|
fi |
3130 |
echo " Depends: ${deps}" |
echo " Depends: ${deps}" |
3131 |
echo " SDepends: ${sdeps}" |
echo " SDepends: ${sdeps}" |
3132 |
echo |
echo |
3317 |
ccache|!ccache) retval=0 ;; |
ccache|!ccache) retval=0 ;; |
3318 |
check|!check) retval=0 ;; |
check|!check) retval=0 ;; |
3319 |
compressdoc|!compressdoc) retval=0 ;; |
compressdoc|!compressdoc) retval=0 ;; |
3320 |
|
debug|!debug) retval=0 ;; |
3321 |
distcc|!distcc) retval=0 ;; |
distcc|!distcc) retval=0 ;; |
3322 |
kernelsrcunpack|!kernelsrcunpack) retval=0 ;; |
kernelsrcunpack|!kernelsrcunpack) retval=0 ;; |
3323 |
libtool|!libtool) retval=0 ;; |
libtool|!libtool) retval=0 ;; |
3324 |
linuxsymlink|!linuxsymlink) retval=0 ;; |
linuxsymlink|!linuxsymlink) retval=0 ;; |
3325 |
pkgbuild|!pkgbuild) retval=0 ;; |
pkgbuild|!pkgbuild) retval=0 ;; |
3326 |
|
pkgdistrotag|!pkgdistrotag) retval=0 ;; |
3327 |
purge|!purge) retval=0 ;; |
purge|!purge) retval=0 ;; |
3328 |
qalint|!qalint) retval=0 ;; |
qalint|!qalint) retval=0 ;; |
3329 |
regentree|!regentree) retval=0 ;; |
regentree|!regentree) retval=0 ;; |
3330 |
stepbystep|!stepbystep) retval=0 ;; |
resume|!resume) retval=0 ;; |
3331 |
srcpkgbuild|!srcpkgbuild) retval=0 ;; |
srcpkgbuild|!srcpkgbuild) retval=0 ;; |
3332 |
srcpkgtarball|!srcpkgtarball) retval=0 ;; |
srcpkgtarball|!srcpkgtarball) retval=0 ;; |
3333 |
|
static|!static) retval=0 ;; |
3334 |
|
stepbystep|!stepbystep) retval=0 ;; |
3335 |
strip|!strip) retval=0 ;; |
strip|!strip) retval=0 ;; |
3336 |
|
verbose|!verbose) retval=0 ;; |
3337 |
*) retval=1 ;; |
*) retval=1 ;; |
3338 |
esac |
esac |
3339 |
|
|
3342 |
|
|
3343 |
load_mage_features() |
load_mage_features() |
3344 |
{ |
{ |
|
echo -en "${COLBLUE}---${COLGREEN} Loading mage-features... ${COLDEFAULT}" |
|
3345 |
for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]} |
for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]} |
3346 |
do |
do |
3347 |
FVERBOSE=off msetfeature ${i} |
FVERBOSE=off msetfeature ${i} |
3348 |
done |
done |
|
|
|
|
echo -e "${COLGREEN}done${COLDEFAULT}" |
|
3349 |
} |
} |
3350 |
|
|
3351 |
msetfeature() |
msetfeature() |
3362 |
|
|
3363 |
if ! known_mage_feature "${feature}" |
if ! known_mage_feature "${feature}" |
3364 |
then |
then |
3365 |
[[ ${FVERBOSE} = off ]] || echo "unkown feature ${feature}, ignoring it" |
[[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}" |
3366 |
return 3 |
return 3 |
3367 |
fi |
fi |
3368 |
|
|
3370 |
do |
do |
3371 |
if [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature} ]] |
if [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature} ]] |
3372 |
then |
then |
3373 |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' already enabled" |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' already enabled${COLDEFAULT}" |
3374 |
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
3375 |
found=1 |
found=1 |
3376 |
elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = !${feature} ]] |
elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = !${feature} ]] |
3377 |
then |
then |
3378 |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' currently disabled, enabling it!" |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' currently disabled, enabling it!${COLDEFAULT}" |
3379 |
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
3380 |
found=1 |
found=1 |
3381 |
elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature//!} ]] |
elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature//!} ]] |
3382 |
then |
then |
3383 |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature//!}' currently enabled, disabling it!" |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature//!}' currently enabled, disabling it!${COLDEFAULT}" |
3384 |
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
3385 |
found=1 |
found=1 |
3386 |
fi |
fi |
3390 |
# it was not declared. in this case enable it |
# it was not declared. in this case enable it |
3391 |
if [[ ${found} = 0 ]] |
if [[ ${found} = 0 ]] |
3392 |
then |
then |
3393 |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' was not declared, enabling it!" |
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' was not declared, enabling it!${COLDEFAULT}" |
3394 |
MAGE_FEATURES_CURRENT=( ${MAGE_FEATURES_CURRENT[*]} "${feature}" ) |
MAGE_FEATURES_CURRENT=( ${MAGE_FEATURES_CURRENT[*]} "${feature}" ) |
3395 |
fi |
fi |
3396 |
|
|
3415 |
fi |
fi |
3416 |
done |
done |
3417 |
else |
else |
3418 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}" |
3419 |
retval=3 |
retval=3 |
3420 |
fi |
fi |
3421 |
|
|