Skip to content
Permalink
Browse files

Make nemsveravail platform independent

  • Loading branch information
NEMS Linux
NEMS Linux committed Dec 9, 2019
1 parent d83fcbf commit 97d4b29f7a175621ef53593287a0b415727ce066
Showing with 35 additions and 5 deletions.
  1. +6 −3 info.sh
  2. +27 −0 tasks.sh
  3. +2 −2 update.sh
@@ -134,10 +134,13 @@ elif [[ $COMMAND == "tv_24h" ]]; then

# Output the current available NEMS version (update.sh generates this every day at midnight and at reboot)
elif [[ $COMMAND == "nemsveravail" ]]; then
if [[ -f /root/nems/nems-migrator/data/nems/ver-current.txt ]]; then
/bin/cat /root/nems/nems-migrator/data/nems/ver-current.txt
elif [[ -f /var/www/html/inc/ver-available.txt ]]; then
if [[ ! -f /var/www/html/inc/ver-available.txt ]]; then
/usr/local/share/nems/nems-scripts/tasks.sh update platform
fi
if [[ -f /var/www/html/inc/ver-available.txt ]]; then
/bin/cat /var/www/html/inc/ver-available.txt
else
/bin/cat /root/nems/nems-migrator/data/nems/ver-current.txt
fi

# Output the number of users connected to server
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php

if (!isset($argv[1])) exit('Invalid usage.' . PHP_EOL);

if (isset($argv[2]) && strlen($argv[2]) > 0) {
$VARIABLE = trim($argv[2]);
} else {
$VARIABLE = '';
}

switch($argv[1]) {

case 'update':

switch ($VARIABLE) {
case 'platform':
$platform['id'] = shell_exec('/usr/local/share/nems/nems-scripts/info.sh platform');
$platform['data'] = @json_decode(@file_get_contents('https://nemslinux.com/api/platform/' . $platform['id']));
if (isset($platform['data']->current_ver) && floatval($platform['data']->current_ver) > 0) file_put_contents('/var/www/html/inc/ver-available.txt',trim($platform['data']->current_ver));
break;
}
break;

}

?>
@@ -65,8 +65,8 @@ else
else
echo " New Commit: $commit"
fi
# Get the latest version data from nems-migrator
cp -f /root/nems/nems-migrator/data/nems/ver-current.txt /var/www/html/inc/ver-available.txt
# Get the latest version data from the NEMS API
/usr/local/share/nems/nems-scripts/tasks.sh update platform

# Update nems-www
echo " - nems-www... "

0 comments on commit 97d4b29

Please sign in to comment.
You can’t perform that action at this time.