A2osX/ADMIN/update.txt

103 lines
2.7 KiB
Plaintext
Raw Normal View History

2021-04-15 20:44:05 +00:00
NEW
PREFIX
AUTO 4,1
#!/bin/sh
#
# This is the ADM Update script
# It is used to update the current installation to the most
# recent version over the internet using httpget
#
2021-07-07 17:31:08 +00:00
# Future Version of this script should add logging to /var/logging
#
if [ $# -ne 1 ]
echo "\nusage: \e[7madm update a2osx\e[0m\n\n or adm update package\n"
echo "for more information: \e[7mhelp adm update\e[0m\n"
2021-04-15 20:44:05 +00:00
exit
fi
2021-07-07 17:31:08 +00:00
if [ $1 != "a2osx" ]
echo "\nOnly \e[7madm update a2osx\e[0m is supported at this time\n"
2021-04-15 20:44:05 +00:00
exit
fi
2021-07-07 17:31:08 +00:00
echo "\nA2osx Update Utility\n"
if [ -d ${BOOT}tmp ]
else
md ${BOOT}tmp
if [ $? -ne 0 ]
echo "\e[7mError\e[0m: creating tmp directory, exiting.\n"
exit
fi
fi
SET -E
#ping -1 update.a2osx.net > /dev/null 2> /dev/null
if [ -f ${BOOT}tmp/latest ]
rm -q ${BOOT}tmp/latest
fi
httpget update.a2osx.net -U latest -o ${BOOT}tmp/latest > /dev/null 2> /dev/null
set RC = $?
switch $RC
2021-04-15 20:44:05 +00:00
case 0
2021-07-07 17:31:08 +00:00
if ![ -f ${BOOT}tmp/latest ]
Echo "\e[7mError\e[0m: Something went teribly wrong!\n"
2021-04-15 20:44:05 +00:00
fi
break
2021-07-07 17:31:08 +00:00
case 120
echo "\e[7mError\e[0m: Hardware Driver not loaded, exiting\n"
exit
case 39
echo "\e[7mError\e[0m: Can not reach update server\n"
echo Try again later, exiting.
exit
2021-04-15 20:44:05 +00:00
default
2021-07-07 17:31:08 +00:00
echo "\e[7mError\e[0m: Unknown error $RC\n"
echo Please contact development team
exit
2021-04-15 20:44:05 +00:00
end
2021-07-07 17:31:08 +00:00
. ${BOOT}tmp/latest
if [ -i $UBLD ]
else
echo "\e[7mError\e[0m: bad build number input\n"
exit
fi
if [ -f ${BOOT}etc/version ]
. ${BOOT}etc/version
else
#no current version file found use default
set BUILD = 1111
fi
#Note only check build right now, need to check OS and VER
if [ $UBLD -le $BUILD ]
echo "\nYour system is already up to date!\n"
exit
else
echo "\nDownloading update...\n"
httpget update.a2osx.net -U update.${UBLD} -o ${BOOT}tmp/update.${UBLD} > /dev/null 2> /dev/null
set BSIZE = `stat -s ${BOOT}tmp/update.${UBLD}`
if [ $BSIZE -ne $USIZE ]
echo "\e[7mError\e[0m: Update did not completely download\n"
echo Please try again, exiting.
exit
fi
cd ${ROOT}
echo "\nInstalling update...\n"
unpak -p ${BOOT}tmp/update.${UBLD}
echo "\nUpdating KMs...\n"
for km in `ls ${ROOT}sys/km.*`
cp -q -y ${ROOT}sys/km/${km} ${ROOT}sys/${km}
next
echo "\nUpdating Version File...\n"
echo "SET OS = A2OSX" > ${BOOT}etc/version
echo "SET VER = 0.94" >> ${BOOT}etc/version
echo "SET BUILD = ${UBLD}" >> ${BOOT}etc/version
echo "\nUpdating Issue File...\n"
echo > ${BOOT}etc/issue
echo "Welcome to A2osX!" >> ${BOOT}etc/issue
echo >> ${BOOT}etc/issue
echo "Build No. ${UBLD}" >> ${BOOT}etc/issue
echo >> ${BOOT}etc/issue
rm -q ${BOOT}tmp/update.${UBLD}
echo "\nUpdate Complete...Rebooting\n"
shutdown -r -t 3
fi
2021-04-15 20:44:05 +00:00
MAN
2021-07-07 17:31:08 +00:00
TEXT /MAKE/usr/share/adm/update