From f27164e39d86f502144b2b00fd871c1c791b3c63 Mon Sep 17 00:00:00 2001 From: mdnapo Date: Sun, 2 Jun 2024 14:17:19 +0200 Subject: [PATCH] Added install script --- MycroForge.CLI/MycroForge.CLI.csproj | 4 ---- MycroForge.CLI/scripts/install.sh | 26 ++++++++++++++++---------- README.md | 3 +++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/MycroForge.CLI/MycroForge.CLI.csproj b/MycroForge.CLI/MycroForge.CLI.csproj index 2102a68..efc5480 100644 --- a/MycroForge.CLI/MycroForge.CLI.csproj +++ b/MycroForge.CLI/MycroForge.CLI.csproj @@ -24,8 +24,4 @@ - - - - diff --git a/MycroForge.CLI/scripts/install.sh b/MycroForge.CLI/scripts/install.sh index e2c6663..dbf9fbb 100644 --- a/MycroForge.CLI/scripts/install.sh +++ b/MycroForge.CLI/scripts/install.sh @@ -1,15 +1,21 @@ #!/usr/bin/bash -TARGET=$1 - -if [ -z "$TARGET" ]; then - echo "The target platform was not provided." +ZIP=$1 +if [ -z "$ZIP" ]; then + echo "The zip file was not provided." exit 1 fi -dotnet publish --self-contained -r linux-x64 -zip -vr releases/m4g-linux.zip bin/Release/net8.0/linux-x64/ -#sudo rm -rf /usr/share/m4g -#sudo cp -r bin/Release/net8.0/linux-x64 /usr/share/m4g -#sudo unlink /usr/local/bin/m4g -#sudo ln -s /usr/share/m4g/MycroForge.CLI /usr/local/bin/m4g +TARGET=${ZIP//"m4g-"/} +TARGET=${TARGET//".zip"/} + +DIR="/tmp/m4g" + +rm -rf "$DIR" +unzip "$ZIP" -d "$DIR" + +sudo rm -rf /usr/share/m4g +sudo cp -r "$DIR/bin/Release/net8.0/$TARGET" /usr/share/m4g + +sudo unlink /usr/local/bin/m4g 2> /dev/null +sudo ln -s /usr/share/m4g/MycroForge.CLI /usr/local/bin/m4g diff --git a/README.md b/README.md index 691076f..493ff87 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,6 @@ The MycroForge CLI assumes a linux compatible environment, so on Windows you'll ### Install +Run the install script in the same directory as the downloaded zip. See the example below for linux-x64. + +`sudo ./install.sh m4g-.zip `