Merge branch 'master' of github:OpenIPC/firmware

pull/132/head
Igor Zalatov (from Citadel PC) 2021-12-24 18:52:59 +03:00
commit a91f56fe12
1 changed files with 27 additions and 21 deletions

View File

@ -123,16 +123,17 @@ writing_rootfs() {
clearing_overlayfs() { clearing_overlayfs() {
if [ $clear_overlayfs -eq 1 ]; then if [ $clear_overlayfs -eq 1 ]; then
sleep 1
echo -e "\n\e[1;31mСlearing the overlayfs partition...\e[0m\n" echo -e "\n\e[1;31mСlearing the overlayfs partition...\e[0m\n"
flash_eraseall -j /dev/${overlay} flash_eraseall -j /dev/${overlay}
fi fi
} }
quick_reboot() { quick_reboot() {
if [ $no_reboot -eq 0 ]; then
echo -e "\n\e[1;31mRebooting without any questions...\e[0m\n" echo -e "\n\e[1;31mRebooting without any questions...\e[0m\n"
sleep 1 sleep 1
reboot -f reboot -f
fi
} }
print_usage() { print_usage() {
@ -149,7 +150,7 @@ print_usage() {
echo " -f skip check md5 hash" echo " -f skip check md5 hash"
echo " --force and hostname" echo " --force and hostname"
echo " -n clear overlayfs" echo " -n clear overlayfs"
echo " -x no reboot after upgrade" echo " -x no reboot after success execution"
echo " -h --help help information" echo " -h --help help information"
} }
@ -218,14 +219,22 @@ do
esac esac
done done
if [ $remotely -eq $locally ] || [ $usage -eq 1 ]; then if ( [ $remotely -eq 1 ] && [ $locally -eq 1 ] ) || [ $usage -eq 1 ] || \
( [ $remotely -eq 0 ] && [ $locally -eq 0 ] && [ $clear_overlayfs -eq 0 ] ); then
print_usage print_usage
echo one
exit 1
fi
if [ $remotely -eq 0 ] && [ $locally -eq 0 ] && [ $clear_overlayfs -eq 1 ]; then
clearing_overlayfs && quick_reboot
exit 1 exit 1
fi fi
[ -z "${kernel_file}" ] && kernel_file="/tmp/uImage.${soc}" [ -z "${kernel_file}" ] && kernel_file="/tmp/uImage.${soc}"
[ -z "${rootfs_file}" ] && rootfs_file="/tmp/rootfs.squashfs.${soc}" [ -z "${rootfs_file}" ] && rootfs_file="/tmp/rootfs.squashfs.${soc}"
if [ $remotely -eq 1 ]; then
if [ $from_url -eq 1 ]; then if [ $from_url -eq 1 ]; then
if [ -z "${url}" ]; then if [ -z "${url}" ]; then
echo -e "\n\e[1;31mThere is no URL to update file...\e[0m\n" echo -e "\n\e[1;31mThere is no URL to update file...\e[0m\n"
@ -238,10 +247,7 @@ else
fi fi
url="${github}/openipc.${soc}-br.tgz" url="${github}/openipc.${soc}-br.tgz"
fi fi
fi
stop_services stop_services
download_firmware "${url}" && check_memory && writing_kernel "${kernel_file}" && writing_rootfs "${rootfs_file}" && clearing_overlayfs download_firmware "${url}" && check_memory && writing_kernel "${kernel_file}" && writing_rootfs "${rootfs_file}" && sleep 1 && clearing_overlayfs && quick_reboot
if [ $no_reboot -eq 0 ]; then
quick_reboot
fi