summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaromil <jaromil@129b00e9-8bf7-0310-bee9-bd51b64996e4>2007-10-25 09:51:53 (GMT)
committer jaromil <jaromil@129b00e9-8bf7-0310-bee9-bd51b64996e4>2007-10-25 09:51:53 (GMT)
commitecc4b9ebbde8930a3d19fcda7b10b1864f9f788d (patch)
treefdce060924f46aa678b43429452559256647bd4d
parentee7aae8016f5b9e97371307186eaaaa2eb6c59fa (diff)
version comparison and updating
git-svn-id: svn://dyne.org/dynebolic@257 129b00e9-8bf7-0310-bee9-bd51b64996e4
-rwxr-xr-xdyneII/startup/bin/dyneupdate74
-rw-r--r--dyneII/startup/lib/utils.sh7
2 files changed, 60 insertions, 21 deletions
diff --git a/dyneII/startup/bin/dyneupdate b/dyneII/startup/bin/dyneupdate
index fb84ac1..bcfb045 100755
--- a/dyneII/startup/bin/dyneupdate
+++ b/dyneII/startup/bin/dyneupdate
@@ -17,12 +17,14 @@ if [ -z $1 ]; then
exit 0
fi
-if ! [ "$2" = "xterm" ]; then
-
- xterm -fn "-*-fixed-medium-*-*-*-18-*-*-*-*-*-*-*" -geometry 76x30 \
- -bg black -fg green -e "dyneupdate $1 xterm"
- exit 0
-
+if [ ${DISPLAY} ]; then
+ if ! [ "$2" = "xterm" ]; then
+
+ xterm -fn "-*-fixed-medium-*-*-*-18-*-*-*-*-*-*-*" -geometry 76x30 \
+ -bg black -fg green -e "dyneupdate $1 xterm"
+ exit 0
+
+ fi
fi
@@ -117,26 +119,48 @@ if [ $? = 0 ]; then
updmods=""
for m in ${(f)mods}; do
tag=`echo ${m} | awk '{print $1}'`
- if [ -r ${DYNE_SYS_MNT}/modules/${tag} ]; then continue; fi
+# uncomment this to exclude existing modules from update
+# if [ -r ${DYNE_SYS_MNT}/modules/${tag} ]; then continue; fi
updmods+="${tag} "
done
updnmods=`echo $updmods | wc -w`
fi
+if [ -r /tmp/install_modules ]; then rm -f /tmp/install_modules; fi
if [ -r /tmp/dialogarg ]; then rm -f /tmp/dialogarg; fi
-echo "--separate-output --checklist \"${updnmods} new modules found, choose which to install:\" 20 60 ${updnmods}" > /tmp/dialogarg
+
+
+c=0
+touch /tmp/dialogarg
for m in ${(f)mods}; do
tag=`echo ${m} | awk '{print $1}'`
- if [ -r ${DYNE_SYS_MNT}/modules/${tag} ]; then continue; fi
+# if [ -r ${DYNE_SYS_MNT}/modules/${tag} ]; then continue; fi
size=`echo ${m} | awk '{ if($2=="R") print $3; else print $2}'`
size="`echo ${size}/1024|bc`"
echo "${tag} \"${size} KB\" ${host}" >> /tmp/dialogarg
+ c=`expr $c + 1`
+# if [ `echo "$c > 6"|bc` = 1 ]; then
+# echo "--separate-output --checklist \"${updnmods} new modules found, choose which to install:\" 20 60 ${c}" \
+# > /tmp/dialogarg2
+# cat /tmp/dialogarg >> /tmp/dialogarg2
+# dynedialog --file /tmp/dialogarg2 2> /tmp/install_modules
+# inst="${inst} `cat /tmp/install_modules | awk '{print $1}'`"
+# rm -f /tmp/install_modules
+# rm -f /tmp/dialogarg
+# rm -f /tmp/dialogarg2
+# c=0
+# fi
done
-
-if [ -r /tmp/install_modules ]; then rm -f /tmp/install_modules; fi
-dynedialog --file /tmp/dialogarg 2> /tmp/install_modules
-inst=`cat /tmp/install_modules | awk '{print $1}'`
-rm -f /tmp/install_modules
+if [ `echo "$c > 0"|bc` = 1 ]; then
+ echo "--separate-output --checklist \"${updnmods} new modules found, choose which to install:\" 20 60 ${c}" \
+ > /tmp/dialogarg2
+ cat /tmp/dialogarg >> /tmp/dialogarg2
+ dynedialog --file /tmp/dialogarg2 2> /tmp/install_modules
+ inst="${inst} `cat /tmp/install_modules | awk '{print $1}'`"
+ rm -f /tmp/install_modules
+ rm -f /tmp/dialogarg
+ rm -f /tmp/dialogarg2
+fi
for i in ${(f)inst}; do
echo "mod $i" >> /tmp/update.actions
@@ -160,16 +184,28 @@ if [ $? = 1 ]; then
rsync -P "${host}::dyne.dock/modules/`echo ${a}|awk '{print $2}'`" $DYNE_SYS_MNT/update/modules/
fi
fi
- echo ${a} | grep '^sys|^sdk'
- if [ $? = 0 ]; then
- sys="`echo ${a}|awk '{print $2}'`"
+ echo ${a} | grep '^sys'
+ if [ $? = 0 ]; then # upate .sys from dock
+ echo ${a} | grep '^sdk'
+
+ if [ $? = 0; then # or from sdk if there is one
+ act "updating dyne.sys from remote SDK"
+ sys_update=SDK/cdrom/dyne/dyne.sys
+ else
+ act "updating dyne.sys from remote dock"
+ sys_update=dyne.sys
+ fi
+
if [ "$rsync" = "true" ]; then
cp ${DYNE_SYS_MNT}/dyne.sys $DYNE_SYS_MNT/update/
+ rsync -P ${host}::dyne.dock/${sys_update} ${DYNE_SYS_MNT}/update/
fi
- # TODO QUAA
+
fi
done
-
+
+ notice "update download!"
+ act "now reboot to complete."
else
error "aborted"
fi \ No newline at end of file
diff --git a/dyneII/startup/lib/utils.sh b/dyneII/startup/lib/utils.sh
index a2f6be9..cbc4daa 100644
--- a/dyneII/startup/lib/utils.sh
+++ b/dyneII/startup/lib/utils.sh
@@ -506,14 +506,17 @@ is_new_version() {
'`"
o="`echo $o | cut -d- -f1`" # strip dashed codenames
- if [ `echo "$o > $n"|bc` = 1 ]; then return 1; fi
+ # old misses a minor version, so new is newer
+ if [ "$o" = "" ]; then return 0; fi
+
+ if [ `echo "${o} > ${n}"|bc` = 1 ]; then return 1; fi
if [ `echo "${n} > ${o}"|bc` = 1 ]; then return 0; fi
done
# return 1 (not new) if same version
- if [ `echo "$o = $n"|bc` = 1 ]; then return 1; fi
+ if [ `echo "${o} == ${n}"|bc` = 1 ]; then return 1; fi
return 0
}