From 6df97af368bd958ddb5d76b6ab5510a89d3531e3 Mon Sep 17 00:00:00 2001 From: karsh Date: Sat, 25 May 2024 00:47:13 +1000 Subject: [PATCH 1/3] user only install readme realised it was possible to install only for local user while reading the source, and realised this rather important info was missing from the readme. tested this command, otherwise is pretty self-explanatory with what it does and how it installs for local user. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index fd911b59..1898bf33 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,16 @@ Make sure that the operating system meets the following prerequisites - Curl tool for downloading the installation script - Basic calculator `bc` command (On Debian run `sudo apt install bc`) +#### system-wide install ```bash curl -s "https://raw.githubusercontent.com/Ph0enixKM/AmberNative/master/setup/install.sh" | $(echo /bin/bash) ``` +#### local-user install +```bash +curl -s "https://raw.githubusercontent.com/Ph0enixKM/AmberNative/master/setup/install.sh" | $(echo /bin/bash) -s -- --user +``` + #### Via a package manager Amber is packaged in the following distros: From 2b7d6832b94cf1b2d212ffc6946a5a94b30ef355 Mon Sep 17 00:00:00 2001 From: karsh Date: Sat, 25 May 2024 00:50:23 +1000 Subject: [PATCH 2/3] added test for /usr/bin/local apparently under certain conditions this directory may not exists on macos. looked online to why, and by the looks of it, this dir is created when certain homebrew installs requires it to be there. now given i didn't have this dir already there, its possible for someone else to have same dir structure as me resulting in installation failure. deleted previous pr... well it got deleted on its own after i synced my fork with upstream but ehh doesnt' matter. one of the later commits cleaned the install script which caused the merge conflict. this commit fixes that. --- setup/shared.ab | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup/shared.ab b/setup/shared.ab index 37b6e5ee..9b6f1106 100644 --- a/setup/shared.ab +++ b/setup/shared.ab @@ -45,7 +45,15 @@ pub fun get_bins_folder(user_only: Bool): Text { if user_only { return "{get_home()}/.local/bin" } else { - return "/usr/local/bin" + // Ensure /usr/local/bin exists for non-user installations + let bins_folder = "/usr/local/bin" + silent $test -d "{bins_folder}"$ failed { + silent $sudo mkdir -p "{bins_folder}"$ failed { + echo "Failed to create {bins_folder} directory." + exit(1) + } + } + return bins_folder } } @@ -55,4 +63,4 @@ pub fun get_place(user_only: Bool): Text { } else { return "/opt/amber" } -} \ No newline at end of file +} From 49884fe59f39f1e5e12d96a4e4f9b9c1c2d2554b Mon Sep 17 00:00:00 2001 From: karsh Date: Sat, 25 May 2024 00:52:38 +1000 Subject: [PATCH 3/3] generated install.sh from install.ab change generated this change from the systemwide amber i got installed by running my patched install.ab script two birds one stone. its confirmed my changes work B) --- setup/install.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/setup/install.sh b/setup/install.sh index b772a22f..7ac24816 100755 --- a/setup/install.sh +++ b/setup/install.sh @@ -98,7 +98,20 @@ function get_bins_folder__31_v0 { __AMBER_FUN_get_bins_folder31_v0="${__AMBER_FUN_get_home30_v0__46}/.local/bin"; return 0 else - __AMBER_FUN_get_bins_folder31_v0="/usr/local/bin"; + local bins_folder="/usr/local/bin"; + test -d "${bins_folder}" +__AMBER_STATUS=$?; +if [ $__AMBER_STATUS != 0 ]; then + sudo mkdir -p "${bins_folder}" > /dev/null 2>&1 +__AMBER_STATUS=$?; +if [ $__AMBER_STATUS != 0 ]; then + echo "Failed to create ${bins_folder} directory."; + exit__20_v0 1 > /dev/null 2>&1; + __AMBER_FUN_exit20_v0__53=${__AMBER_FUN_exit20_v0}; + echo ${__AMBER_FUN_exit20_v0__53} > /dev/null 2>&1 +fi +fi; + __AMBER_FUN_get_bins_folder31_v0="${bins_folder}"; return 0 fi }; @@ -106,10 +119,10 @@ function get_place__32_v0 { local user_only=$1 if [ ${user_only} != 0 ]; then get_home__30_v0 ; - __AMBER_FUN_get_home30_v0__54=${__AMBER_FUN_get_home30_v0}; + __AMBER_FUN_get_home30_v0__62=${__AMBER_FUN_get_home30_v0}; get_arch__29_v0 ; - __AMBER_FUN_get_arch29_v0__54=${__AMBER_FUN_get_arch29_v0}; - __AMBER_FUN_get_place32_v0="${__AMBER_FUN_get_home30_v0__54}/.local/lib/${__AMBER_FUN_get_arch29_v0__54}/amber"; + __AMBER_FUN_get_arch29_v0__62=${__AMBER_FUN_get_arch29_v0}; + __AMBER_FUN_get_place32_v0="${__AMBER_FUN_get_home30_v0__62}/.local/lib/${__AMBER_FUN_get_arch29_v0__62}/amber"; return 0 else __AMBER_FUN_get_place32_v0="/opt/amber";