mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 18:44:44 +00:00
firmware: strict install policy using php version_compare() #4500
We have to see how this holds up in practice. Reinstall was considered as well for further protection but that might be even trickier depending on what locking and version tricks the user did to their install to retain a particular (working) state.
This commit is contained in:
parent
e4392fb854
commit
0f1484b3a2
@ -26,7 +26,7 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress
|
||||
PACKAGE=$1
|
||||
PACKAGE=${1}
|
||||
|
||||
# Truncate upgrade progress file
|
||||
: > ${PKG_PROGRESS_FILE}
|
||||
@ -38,8 +38,8 @@ if [ "${PACKAGE#os-}" != "${PACKAGE}" ]; then
|
||||
REPOVER=$(pkg rquery %v ${COREPKG})
|
||||
|
||||
# plugins must pass a version check on up-to-date core package
|
||||
if [ "${REPOVER%_*}" != "${COREVER%_*}" ]; then
|
||||
echo "Installation is out of date: please install system updates first." >> ${PKG_PROGRESS_FILE} 2>&1
|
||||
if ! php -r "exit(version_compare('${COREVER}','${REPOVER}') >= 0 ? 0 : 1);"; then
|
||||
echo "Installation out of date. The update to ${COREPKG}-${REPOVER} is required." >> ${PKG_PROGRESS_FILE} 2>&1
|
||||
echo '***DONE***' >> ${PKG_PROGRESS_FILE}
|
||||
exit
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user