Skip to content

Commit

Permalink
chore: first ready script
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-segning committed Aug 13, 2024
1 parent cdc7771 commit 5d9a9cd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
21 changes: 13 additions & 8 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Set the app configuration folder
# Default WOPS_VERSION to the latest if not provided
$WOPS_VERSION = $env:WOPS_VERSION
if (-not $WOPS_VERSION) {
$WOPS_VERSION = "latest"
}

# Set the app configuration folder and bin directory
$ConfigDir = "$env:APPDATA\wazuh-cert-oauth2-client"
$BinDir = "$env:USERPROFILE\AppData\Local\Microsoft\WindowsApps"

# Determine the architecture
$Arch = (Get-WmiObject -Class Win32_Processor).Architecture
Expand All @@ -9,9 +16,8 @@ switch ($Arch) {
default { Write-Host "Unsupported architecture: $Arch"; exit 1 }
}

$WopsVersion = "0.1.1" # Replace with the actual version
# URL for downloading the zip file
$BaseUrl = "https://github.com/ADORSYS-GIS/wazuh-cert-oauth2/releases/download/v$WOPS_VERSION" # Replace with your actual URL
$BaseUrl = "https://github.com/ADORSYS-GIS/wazuh-cert-oauth2/releases/download/v$WOPS_VERSION"
$ZipFile = "wazuh-cert-oauth2-client-$Arch-windows.zip"
$Url = "$BaseUrl/$ZipFile"

Expand All @@ -33,13 +39,12 @@ if (!$?) {
exit 1
}

# Move the binary to the configuration folder
Write-Host "Installing binary to $ConfigDir..."
New-Item -ItemType Directory -Force -Path $ConfigDir
Move-Item -Path "$TempExtractDir\wazuh-cert-oauth2-client.exe" -Destination "$ConfigDir\wazuh-cert-oauth2-client.exe" -Force
# Move the binary to the BinDir
Write-Host "Installing binary to $BinDir..."
Move-Item -Path "$TempExtractDir\wazuh-cert-oauth2-client.exe" -Destination "$BinDir\wazuh-cert-oauth2-client.exe" -Force

# Cleanup
Remove-Item -Path $TempZipPath -Force
Remove-Item -Path $TempExtractDir -Recurse -Force

Write-Host "Installation complete!"
Write-Host "Installation complete! You can now use 'wazuh-cert-oauth2-client' from your terminal."
28 changes: 12 additions & 16 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/bin/bash

# Default WOPS_VERSION to the latest if not provided
WOPS_VERSION=${WOPS_VERSION:-"latest"}

# Set the app configuration folder based on the OS
case "$OSTYPE" in
linux-gnu*)
CONFIG_DIR="$HOME/.config/wazuh-cert-oauth2-client"
BIN_DIR="$HOME/.local/bin"
OS="linux"
;;
darwin*)
CONFIG_DIR="$HOME/Library/Application Support/wazuh-cert-oauth2-client"
BIN_DIR="/usr/local/bin"
OS="macos"
;;
msys*|cygwin*|win32)
CONFIG_DIR="$APPDATA\\wazuh-cert-oauth2-client"
OS="windows"
;;
*)
echo "Unsupported OS: $OSTYPE"
exit 1
Expand All @@ -35,9 +36,8 @@ case "$ARCH" in
;;
esac

WOPS_VERSION="0.1.1" # Replace with your actual version
# URL for downloading the zip file
BASE_URL="https://github.com/ADORSYS-GIS/wazuh-cert-oauth2/releases/download/v$WOPS_VERSION" # Replace with your actual URL
BASE_URL="https://github.com/ADORSYS-GIS/wazuh-cert-oauth2/releases/download/v$WOPS_VERSION"
ZIP_FILE="wazuh-cert-oauth2-client-${ARCH}-${OS}.zip"
URL="$BASE_URL/$ZIP_FILE"

Expand All @@ -57,17 +57,13 @@ if [ $? -ne 0 ]; then
exit 1
fi

# Move the binary to the configuration folder
echo "Installing binary to $CONFIG_DIR..."
mkdir -p "$CONFIG_DIR"
if [ "$OS" == "windows" ]; then
mv "/tmp/wazuh-cert-oauth2-client/wazuh-cert-oauth2-client.exe" "$CONFIG_DIR/"
else
mv "/tmp/wazuh-cert-oauth2-client/wazuh-cert-oauth2-client" "$CONFIG_DIR/"
chmod +x "$CONFIG_DIR/wazuh-cert-oauth2-client"
fi
# Move the binary to the BIN_DIR
echo "Installing binary to $BIN_DIR..."
mkdir -p "$BIN_DIR"
mv "/tmp/wazuh-cert-oauth2-client/wazuh-cert-oauth2-client" "$BIN_DIR/"
chmod +x "$BIN_DIR/wazuh-cert-oauth2-client"

# Cleanup
rm -rf "/tmp/$ZIP_FILE" "/tmp/wazuh-cert-oauth2-client"

echo "Installation complete!"
echo "Installation complete! You can now use 'wazuh-cert-oauth2-client' from your terminal."
2 changes: 1 addition & 1 deletion wazuh-cert-oauth2-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2-client"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion wazuh-cert-oauth2-model/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2-model"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion wazuh-cert-oauth2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand Down

0 comments on commit 5d9a9cd

Please sign in to comment.