1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/bin/update-alx.sh,v 1.1 2005-08-18 02:50:17 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/bin/update-alx.sh,v 1.4 2006-02-20 14:49:30 niro Exp $ |
3 |
|
|
4 |
|
die() |
5 |
|
{ |
6 |
|
echo |
7 |
|
echo "Error: $@. Update *not* successfull." |
8 |
|
exit 1 |
9 |
|
} |
10 |
|
|
11 |
diskfree() |
diskfree() |
12 |
{ |
{ |
57 |
|
|
58 |
# in kilobytes ! min 50MB are needed !! |
# in kilobytes ! min 50MB are needed !! |
59 |
MIN_SPACE=50000 |
MIN_SPACE=50000 |
60 |
SERVER_SHARE="//${SQL_HOST}/magetmp" |
SERVER_SHARE="${SMB_UPDATE_HOST}" |
61 |
USER="${SQL_USER}" |
USER="${SMB_UPDATE_USER}" |
62 |
PASS="${SQL_PASS}" |
PASS="${SMB_UPDATE_PASS}" |
63 |
|
|
64 |
|
# setup mage.rc |
65 |
|
sed -i -e "s@^\(MIRRORS=\).*@\1\"${MAGE_MIRRORS}\"@" \ |
66 |
|
-e "s@^\(RSYNC=\).*@\1\"${MAGE_RSYNC}\"@" \ |
67 |
|
/etc/mage.rc || die "fixing /etc/mage.rc" |
68 |
|
|
69 |
if [[ $(diskfree /) < ${MIN_SPACE} ]]; then |
if [ $(diskfree /) -le ${MIN_SPACE} ]; then |
70 |
echo "mounting server" |
echo "Mounting server '${SERVER_SHARE}' ..." |
71 |
# make a secure tmp dir |
# make a secure tmp dir |
72 |
if [ -x /bin/mktemp ]; then |
if [ -x /bin/mktemp ]; then |
73 |
TEMPDIR="$(/bin/mktemp -d)" |
TEMPDIR="$(/bin/mktemp -d)" |
86 |
mount -o bind ${TEMPDIR}/${HOSTNAME}/packages ${PKGDIR} |
mount -o bind ${TEMPDIR}/${HOSTNAME}/packages ${PKGDIR} |
87 |
fi |
fi |
88 |
|
|
89 |
echo "running update" |
echo "Running update ..." |
90 |
# fetching new db |
# fetching new db |
91 |
mage update |
|
92 |
|
echo "Fetching mage database update ..." |
93 |
|
mage update > /dev/null || die "mage update" |
94 |
|
|
95 |
### demo hotfix### |
### demo hotfix### |
96 |
#cp /usr/mage/profiles/alx-041/* /etc/mage-profile |
#cp /usr/mage/profiles/alx-041/* /etc/mage-profile |
104 |
mount /boot &> /dev/null |
mount /boot &> /dev/null |
105 |
|
|
106 |
# first update mage |
# first update mage |
107 |
mage install mage-alx |
mage install mage-alx || die "install mage" |
108 |
|
|
109 |
# than clean forcefully all packages that does not fit the profile |
# than clean forcefully all packages that does not fit the profile |
110 |
if [ -f /etc/mage-profile/forced-uninstall ] |
if [ -f /etc/mage-profile/forced-uninstall ] |
113 |
fi |
fi |
114 |
|
|
115 |
# than update the whole system |
# than update the whole system |
116 |
mageupgrade --no-calc --autoclean --autoanswer #--debug |
mageupgrade --no-calc --autoclean --autoanswer || die "system upgrade" #--debug |
117 |
|
|
118 |
# umount BUILDDIR |
# umount BUILDDIR |
119 |
if is_mounted ${BUILDDIR}; then |
if is_mounted ${BUILDDIR}; then |
133 |
if is_mounted ${TEMPDIR}; then |
if is_mounted ${TEMPDIR}; then |
134 |
umount_server |
umount_server |
135 |
fi |
fi |
136 |
|
|
137 |
|
### check mage version for 0.>4.x-rxx |
138 |
|
#/sbin/mage version | egrep v0.[4-9].[0-9]-r?? |
139 |
|
|