mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
firmware: progress on speedup and elaborate release type change #2066
This commit is contained in:
parent
4b07ed39ca
commit
6239acec5c
@ -33,6 +33,7 @@
|
||||
# download_size: <size_of_total_downloads>
|
||||
# new_packages: array with { name: <package_name>, version: <package_version> }
|
||||
# reinstall_packages: array with { name: <package_name>, version: <package_version> }
|
||||
# remove_packages: array with { name: <package_name>, version: <package_version> }
|
||||
# downgrade_packages: array with { name: <package_name>, current_version: <current_version>, new_version: <new_version> }
|
||||
# upgrade_packages: array with { name: <package_name>, current_version: <current_version>, new_version: <new_version> }
|
||||
|
||||
@ -77,8 +78,14 @@ if [ "$pkg_running" == "" ]; then
|
||||
if [ $timer -gt 0 ] ; then
|
||||
# Connection is ok
|
||||
connection="ok"
|
||||
# Now check if there are upgrades
|
||||
pkg upgrade -n > $tmp_pkg_output_file &
|
||||
# now check what happens when we would go ahead
|
||||
if [ -z "${1}" ]; then
|
||||
pkg upgrade -n > $tmp_pkg_output_file &
|
||||
else
|
||||
# fetch before install lets us know more
|
||||
pkg fetch -y "${1}" > $tmp_pkg_output_file &
|
||||
pkg install -n "${1}" > $tmp_pkg_output_file &
|
||||
fi
|
||||
# Reset timer before getting upgrade info
|
||||
timer=$timeout # Reset our timer
|
||||
pkg_running="started" # Set running state to arbitrary value
|
||||
@ -114,19 +121,17 @@ if [ "$pkg_running" == "" ]; then
|
||||
fi
|
||||
|
||||
# First check if there are new packages that need to be installed
|
||||
for i in $(cat $tmp_pkg_output_file); do
|
||||
for i in $(grep -q INSTALLED: $tmp_pkg_output_file && cat $tmp_pkg_output_file); do
|
||||
if [ "$itemcount" -gt "$linecount" ]; then
|
||||
if [ `echo $linecount + 2 | bc` -eq "$itemcount" ]; then
|
||||
if [ "`echo $i | grep ':'`" == "" ]; then
|
||||
itemcount=0 # This is not a valid item so reset item count
|
||||
else
|
||||
i=`echo $i | tr -d :`
|
||||
#echo "name:$i"
|
||||
if [ "$packages_new" == "" ]; then
|
||||
packages_new=$packages_new"{\"name\":\"$i\"," # If it is the first item then we do not want a seperator
|
||||
else
|
||||
packages_new=$packages_new", {\"name\":\"$i\","
|
||||
if [ "$packages_new" != "" ]; then
|
||||
packages_new=$packages_new","
|
||||
fi
|
||||
packages_new=$packages_new"{\"name\":\"$i\","
|
||||
fi
|
||||
fi
|
||||
if [ `echo $linecount + 1 | bc` -eq "$itemcount" ]; then
|
||||
@ -141,7 +146,7 @@ if [ "$pkg_running" == "" ]; then
|
||||
done
|
||||
|
||||
# Check if there are packages that need to be reinstalled
|
||||
for i in $(cat $tmp_pkg_output_file | cut -d '(' -f1); do
|
||||
for i in $(grep -q REINSTALLED: $tmp_pkg_output_file && cat $tmp_pkg_output_file); do
|
||||
if [ "$itemcount" -gt "$linecount" ]; then
|
||||
if [ `echo $linecount + 1 | bc` -eq "$itemcount" ]; then
|
||||
if [ "`echo $i | grep '-'`" == "" ]; then
|
||||
@ -150,13 +155,10 @@ if [ "$pkg_running" == "" ]; then
|
||||
name=${i%-*}
|
||||
version=${i##*-}
|
||||
itemcount=`echo $itemcount + 1 | bc` # Get ready for next item
|
||||
if [ "$packages_reinstall" == "" ]; then
|
||||
packages_reinstall=$packages_reinstall"{\"name\":\"$name\"," # If it is the first item then we do not want a seperator
|
||||
packages_reinstall=$packages_reinstall"\"version\":\"$version\"}"
|
||||
else
|
||||
packages_reinstall=$packages_reinstall", {\"name\":\"$name\","
|
||||
packages_reinstall=$packages_reinstall"\"version\":\"$version\"}"
|
||||
if [ "$packages_reinstall" != "" ]; then
|
||||
packages_reinstall=$packages_reinstall"," # separator for next item
|
||||
fi
|
||||
packages_reinstall=$packages_reinstall"{\"name\":\"$name\",\"version\":\"$version\"}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -167,7 +169,7 @@ if [ "$pkg_running" == "" ]; then
|
||||
done
|
||||
|
||||
# Now check if there are upgrades to install
|
||||
for i in $(cat $tmp_pkg_output_file); do
|
||||
for i in $(grep -q UPGRADED: $tmp_pkg_output_file && cat $tmp_pkg_output_file); do
|
||||
if [ "$itemcount" -gt "$linecount" ]; then
|
||||
if [ `echo $linecount + 4 | bc` -eq "$itemcount" ]; then
|
||||
if [ "`echo $i | grep ':'`" == "" ]; then
|
||||
@ -200,7 +202,7 @@ if [ "$pkg_running" == "" ]; then
|
||||
done
|
||||
|
||||
# Now check if there are downgrades to install
|
||||
for i in $(cat $tmp_pkg_output_file); do
|
||||
for i in $(grep -q DOWNGRADED: $tmp_pkg_output_file && cat $tmp_pkg_output_file); do
|
||||
if [ "$itemcount" -gt "$linecount" ]; then
|
||||
if [ `echo $linecount + 4 | bc` -eq "$itemcount" ]; then
|
||||
if [ "`echo $i | grep ':'`" == "" ]; then
|
||||
@ -228,6 +230,28 @@ if [ "$pkg_running" == "" ]; then
|
||||
fi
|
||||
done
|
||||
|
||||
# Now check if there are package removals
|
||||
for i in $(grep -q REMOVED: $tmp_pkg_output_file && cat $tmp_pkg_output_file); do
|
||||
if [ "$itemcount" -gt "$linecount" ]; then
|
||||
if [ `echo $linecount + 1 | bc` -eq "$itemcount" ]; then
|
||||
if [ "`echo $i | grep '-'`" == "" ]; then
|
||||
itemcount=0 # This is not a valid item so reset item count
|
||||
else
|
||||
name=${i%-*}
|
||||
version=${i##*-}
|
||||
itemcount=`echo $itemcount + 1 | bc` # Get ready for next item
|
||||
if [ -n "$packages_remove" ]; then
|
||||
packages_remove=$packages_remove"," # separator for next item
|
||||
fi
|
||||
packages_remove=$packages_remove"{\"name\":\"$name\",\"version\":\"$version\"}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
linecount=`echo $linecount + 1 | bc`
|
||||
if [ "$i" == "REMOVED:" ]; then
|
||||
itemcount=`echo $linecount + 1 | bc`
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# the main update from package will provide this during upgrade
|
||||
@ -322,11 +346,12 @@ if [ "$pkg_running" == "" ]; then
|
||||
"product_name":"$product_name",
|
||||
"product_version":"$product_version",
|
||||
"reinstall_packages":[$packages_reinstall],
|
||||
"remove_packages":[$packages_remove],
|
||||
"repository":"$repository",
|
||||
"updates":"$updates",
|
||||
"upgrade_needs_reboot":"$upgrade_needs_reboot",
|
||||
"upgrade_major_message":"$upgrade_major_message",
|
||||
"upgrade_major_version":"$upgrade_major_version",
|
||||
"upgrade_needs_reboot":"$upgrade_needs_reboot",
|
||||
"upgrade_packages":[$packages_upgraded]
|
||||
}
|
||||
EOF
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user