mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-28 10:52:33 +00:00
104 lines
2.8 KiB
Plaintext
104 lines
2.8 KiB
Plaintext
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
|
||
#
|
||
# 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"
|
||
exit
|
||
fi
|
||
if [ $1 != "a2osx" ]
|
||
echo "\nOnly \e[7madm update a2osx\e[0m is supported at this time\n"
|
||
exit
|
||
fi
|
||
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
|
||
chtyp TXT ${BOOT}tmp/latest
|
||
set RC = $?
|
||
switch $RC
|
||
case 0
|
||
if ![ -f ${BOOT}tmp/latest ]
|
||
Echo "\e[7mError\e[0m: Something went teribly wrong!\n"
|
||
fi
|
||
break
|
||
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
|
||
default
|
||
echo "\e[7mError\e[0m: Unknown error $RC\n"
|
||
echo Please contact development team
|
||
exit
|
||
end
|
||
. ${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
|
||
chtyp 0CF ${BOOT}tmp/update.${UBLD}
|
||
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 "# A2osX Build Version File" > ${BOOT}etc/version
|
||
echo "${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
|
||
MAN
|
||
TEXT /MAKE/usr/share/adm/update
|