Skip to content

Commit

Permalink
Improving the current release version retrieval mechanism, installer …
Browse files Browse the repository at this point in the history
…and uninstaller now automatically adds and removes (a symlink) the main pirrot bin to /usr/local/bin to provide simplified access to the pirrot CLI.
  • Loading branch information
allebb committed May 12, 2020
1 parent a24b05b commit bd4c292
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.6
26 changes: 20 additions & 6 deletions app/Commands/VersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ class VersionCommand extends BaseCommand implements CommandInterface
{
use RecievesArgumentsTrait;

/**
* The Pirrot release/version number.
*/
const PIRROT_VERSION = "1.5.0";

/**
* The file where the OS information can be retrieved from.
*/
Expand All @@ -41,15 +36,22 @@ class VersionCommand extends BaseCommand implements CommandInterface
*/
private $hardwareVersion = "**not detected**";

/**
* The Pirrot version (release) number.
* @var string
*/
private $pirrotVersion = "**not detected**";

/**
* Handle the command.
* @return void
*/
public function handle()
{
$this->detectPirrotVersion();
$this->detectRaspbianVersion();
$this->detectHardwareVersion();
$this->writeln('Pirrot v' . self::PIRROT_VERSION);
$this->writeln('Pirrot v' . $this->pirrotVersion);
$this->writeln(' - HW version: ' . $this->hardwareVersion);
$this->writeln(' - OS version: ' . $this->raspbainVersion);
$this->writeln(' - Compiler version: ' . phpversion() . ' (' . php_uname('v') . ') on ' . php_uname('m'));
Expand Down Expand Up @@ -86,6 +88,18 @@ private function detectRaspbianVersion()
if (isset($versionMatches[1])) {
$this->raspbainVersion = trim(ucwords($osMatches[1]), '"') . " " . trim($versionMatches[1], '"');
}
}

/**
* Detects the Pirrot release version.
* @return void
*/
private function detectPirrotVersion()
{
$pirrotVersionInfo = '/opt/pirrot/VERSION';
if (!file_exists($pirrotVersionInfo)) {
return;
}
$this->pirrotVersion = trim(file_get_contents($pirrotVersionInfo));
}
}
4 changes: 4 additions & 0 deletions build/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ fi
echo " - Setting execution bit on /opt/pirrot/pirrot..."
sudo chmod +x /opt/pirrot/pirrot

# Make "pirrot" accessible from the PATH...
sudo ln -s /opt/pirrot/pirrot /usr/local/bin/pirrot


# Chmod storage directories
sudo mkdir /opt/pirrot/storage
sudo mkdir /opt/pirrot/storage/input
Expand Down
1 change: 1 addition & 0 deletions build/scripts/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ echo "- Running OS specific cleanup..."
source /opt/pirrot/build/scripts/os_versions/${OS}_${VER_NO}.uninstall
echo ""
echo "- Deleting Pirrot application from disk..."
sudo rm -f /usr/local/bin/pirrot
sudo rm -Rf /opt/pirrot

echo "Done!"
Expand Down

0 comments on commit bd4c292

Please sign in to comment.