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.2 2005-08-28 19:31:34 niro Exp $ |
3 |
|
|
4 |
|
die() |
5 |
|
{ |
6 |
|
echo |
7 |
|
echo "Error: $@. Update *not* successfull." |
8 |
|
exit 1 |
9 |
|
} |
10 |
|
|
11 |
diskfree() |
diskfree() |
12 |
{ |
{ |
61 |
USER="${SQL_USER}" |
USER="${SQL_USER}" |
62 |
PASS="${SQL_PASS}" |
PASS="${SQL_PASS}" |
63 |
|
|
64 |
if [[ $(diskfree /) < ${MIN_SPACE} ]]; then |
if [ $(diskfree /) -le ${MIN_SPACE} ]; then |
65 |
echo "mounting server" |
echo "Mounting server '${SERVER_SHARE}' ..." |
66 |
# make a secure tmp dir |
# make a secure tmp dir |
67 |
if [ -x /bin/mktemp ]; then |
if [ -x /bin/mktemp ]; then |
68 |
TEMPDIR="$(/bin/mktemp -d)" |
TEMPDIR="$(/bin/mktemp -d)" |
81 |
mount -o bind ${TEMPDIR}/${HOSTNAME}/packages ${PKGDIR} |
mount -o bind ${TEMPDIR}/${HOSTNAME}/packages ${PKGDIR} |
82 |
fi |
fi |
83 |
|
|
84 |
echo "running update" |
echo "Running update ..." |
85 |
# fetching new db |
# fetching new db |
86 |
mage update |
|
87 |
|
echo "Fetching mage database update ..." |
88 |
|
mage update > /dev/null || die "mage update" |
89 |
|
|
90 |
### demo hotfix### |
### demo hotfix### |
91 |
#cp /usr/mage/profiles/alx-041/* /etc/mage-profile |
#cp /usr/mage/profiles/alx-041/* /etc/mage-profile |
99 |
mount /boot &> /dev/null |
mount /boot &> /dev/null |
100 |
|
|
101 |
# first update mage |
# first update mage |
102 |
mage install mage-alx |
mage install mage-alx || die "install mage" |
103 |
|
|
104 |
# than clean forcefully all packages that does not fit the profile |
# than clean forcefully all packages that does not fit the profile |
105 |
if [ -f /etc/mage-profile/forced-uninstall ] |
if [ -f /etc/mage-profile/forced-uninstall ] |
108 |
fi |
fi |
109 |
|
|
110 |
# than update the whole system |
# than update the whole system |
111 |
mageupgrade --no-calc --autoclean --autoanswer #--debug |
mageupgrade --no-calc --autoclean --autoanswer || die "system upgrade" #--debug |
112 |
|
|
113 |
# umount BUILDDIR |
# umount BUILDDIR |
114 |
if is_mounted ${BUILDDIR}; then |
if is_mounted ${BUILDDIR}; then |