mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
@ -30,6 +30,19 @@ public function upgrade(): void
|
||||
);
|
||||
}
|
||||
|
||||
public function availableUpdates(): int
|
||||
{
|
||||
$result = $this->server->ssh()->exec(
|
||||
$this->getScript('available-updates.sh'),
|
||||
'check-available-updates'
|
||||
);
|
||||
|
||||
// -1 because the first line is not a package
|
||||
$availableUpdates = str($result)->after('Available updates:')->trim()->toInteger() - 1;
|
||||
|
||||
return max($availableUpdates, 0);
|
||||
}
|
||||
|
||||
public function createUser(string $user, string $password, string $key): void
|
||||
{
|
||||
$this->server->ssh()->exec(
|
||||
|
5
app/SSH/OS/scripts/available-updates.sh
Normal file
5
app/SSH/OS/scripts/available-updates.sh
Normal file
@ -0,0 +1,5 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
|
||||
AVAILABLE_UPDATES=$(sudo DEBIAN_FRONTEND=noninteractive apt list --upgradable | wc -l)
|
||||
|
||||
echo "Available updates:$AVAILABLE_UPDATES"
|
@ -1,3 +1,8 @@
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common curl zip unzip git gcc openssl
|
||||
git config --global user.email "__email__"
|
||||
git config --global user.name "__name__"
|
||||
|
||||
# Install Node.js
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -;
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install nodejs -y
|
||||
|
@ -2,8 +2,3 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get clean
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
|
||||
|
||||
# Install Node.js
|
||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -;
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install nodejs -y
|
||||
|
Reference in New Issue
Block a user