From eb55c8daa870ca335b047141b755c4f63d14961c Mon Sep 17 00:00:00 2001 From: Jeff Hykin Date: Tue, 14 Nov 2023 17:32:20 -0600 Subject: [PATCH 1/3] Update uninstaller_helper --- settings/extensions/nix/uninstaller_helper | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/settings/extensions/nix/uninstaller_helper b/settings/extensions/nix/uninstaller_helper index dadb8a7..ed6d7a7 100755 --- a/settings/extensions/nix/uninstaller_helper +++ b/settings/extensions/nix/uninstaller_helper @@ -20,7 +20,6 @@ fi if [ "$(uname)" = "Darwin" ] then - # TODO: make sure this fully removes LaunchDaemon: org.nixos.darwin-store sudo launchctl bootout system/org.nixos.darwin-store # check if file exists @@ -200,4 +199,4 @@ then echo "Because your system mounted /nix during boot" echo "I believe you'll need to restart for changes to take affect" fi -fi \ No newline at end of file +fi From 757baaed58a2948acc5119079d6ac8122553b297 Mon Sep 17 00:00:00 2001 From: Jeff Hykin Date: Tue, 14 Nov 2023 17:33:28 -0600 Subject: [PATCH 2/3] Update uninstaller_helper --- settings/extensions/nix/uninstaller_helper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/extensions/nix/uninstaller_helper b/settings/extensions/nix/uninstaller_helper index ed6d7a7..43b9cde 100755 --- a/settings/extensions/nix/uninstaller_helper +++ b/settings/extensions/nix/uninstaller_helper @@ -3,7 +3,7 @@ echo "" echo "If you've still got a problem after this" if [ "$(uname)" = "Darwin" ] -then +then echo "take a look here: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos" else echo "take a look here: https://nixos.org/manual/nix/stable/installation/installing-binary.html#linux" From 49ea6587d26f366df9a1751d5658235a853dbcd2 Mon Sep 17 00:00:00 2001 From: Jeff Hykin Date: Fri, 17 Nov 2023 16:52:06 -0600 Subject: [PATCH 3/3] fix realpath new macos --- .../commands/tools/file_system/relative_link | 15 ++++++- settings/fornix_core | 39 +++++++------------ 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/settings/extensions/#standard/commands/tools/file_system/relative_link b/settings/extensions/#standard/commands/tools/file_system/relative_link index 4c8ee80..b6b5702 100755 --- a/settings/extensions/#standard/commands/tools/file_system/relative_link +++ b/settings/extensions/#standard/commands/tools/file_system/relative_link @@ -71,7 +71,20 @@ rm -f "$target_filepath" 2>/dev/null rm -rf "$target_filepath" 2>/dev/null # make sure parent folder exists mkdir -p "$(dirname "$target_filepath")" -__temp_var__relative_part="$(realpath "$(dirname "$existing_filepath")" --relative-to="$(dirname "$target_filepath")" --canonicalize-missing)" +# get deno for realpath +deno="$HOME/.deno/1.36.1/bin/deno" +if ! [ -x "$deno" ]; then + "\"",`$(echo --% ' |out-null)" >$null;function :{};function dv{<#${/*'>/dev/null )` 2>/dev/null;dv() { #> + echo "1.36.1"; : --% ' |out-null <#'; }; version="$(dv)"; if [ -x "$deno" ]; then :; elif [ -f "$deno" ]; then :; fi; bin_dir="$HOME/.deno/$version/bin"; exe="$bin_dir/deno"; has () { command -v "$1" >/dev/null; } ; if ! has unzip; then if ! has apt-get; then has brew && brew install unzip; else if [ "$(whoami)" = "root" ]; then apt-get install unzip -y; elif has sudo; then echo "Can I install unzip for you? (its required for this command to work) ";read ANSWER;echo; if [ "$ANSWER" =~ ^[Yy] ]; then sudo apt-get install unzip -y; fi; elif has doas; then echo "Can I install unzip for you? (its required for this command to work) ";read ANSWER;echo; if [ "$ANSWER" =~ ^[Yy] ]; then doas apt-get install unzip -y; fi; fi; fi; fi; if ! has unzip; then echo ""; echo "So I couldn't find an 'unzip' command"; echo "And I tried to auto install it, but it seems that failed"; echo "(This script needs unzip and either curl or wget)"; echo "Please install the unzip command manually then re-run this script"; exit 1; fi; repo="denoland/deno"; if [ "$OS" = "Windows_NT" ]; then target="x86_64-pc-windows-msvc"; else :; case $(uname -sm) in "Darwin x86_64") target="x86_64-apple-darwin" ;; "Darwin arm64") target="aarch64-apple-darwin" ;; "Linux aarch64") repo="LukeChannings/deno-arm64" target="linux-arm64" ;; "Linux armhf") echo "deno sadly doesn't support 32-bit ARM. Please check your hardware and possibly install a 64-bit operating system." exit 1 ;; *) target="x86_64-unknown-linux-gnu" ;; esac; fi; deno_uri="https://github.com/$repo/releases/download/v$version/deno-$target.zip"; exe="$bin_dir/deno"; if [ ! -d "$bin_dir" ]; then mkdir -p "$bin_dir"; fi; if ! curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri"; then if ! wget --output-document="$exe.zip" "$deno_uri"; then echo "Howdy! I looked for the 'curl' and for 'wget' commands but I didn't see either of them. Please install one of them, otherwise I have no way to install the missing deno version needed to run this code"; exit 1; fi; fi; unzip -d "$bin_dir" -o "$exe.zip"; chmod +x "$exe"; rm "$exe.zip"; :; #>}; $DenoInstall = "${HOME}/.deno/$(dv)"; $BinDir = "$DenoInstall/bin"; $DenoExe = "$BinDir/deno.exe"; if (-not(Test-Path -Path "$DenoExe" -PathType Leaf)) { $DenoZip = "$BinDir/deno.zip"; $DenoUri = "https://github.com/denoland/deno/releases/download/v$(dv)/deno-x86_64-pc-windows-msvc.zip"; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; if (!(Test-Path $BinDir)) { New-Item $BinDir -ItemType Directory | Out-Null; }; Function Test-CommandExists { Param ($command); $oldPreference = $ErrorActionPreference; $ErrorActionPreference = "stop"; try {if(Get-Command "$command"){RETURN $true}} Catch {Write-Host "$command does not exist"; RETURN $false}; Finally {$ErrorActionPreference=$oldPreference}; }; if (Test-CommandExists curl) { curl -Lo $DenoZip $DenoUri; } else { curl.exe -Lo $DenoZip $DenoUri; }; if (Test-CommandExists curl) { tar xf $DenoZip -C $BinDir; } else { tar -Lo $DenoZip $DenoUri; }; Remove-Item $DenoZip; $User = [EnvironmentVariableTarget]::User; $Path = [Environment]::GetEnvironmentVariable('Path', $User); if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) { [Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User); $Env:Path += ";$BinDir"; } }; & "$DenoExe" run -q -A "$PSCommandPath" @args; Exit $LastExitCode; <# + # */0}`; +fi +__temp_var__relative_part="$("$deno" eval ' + import { FileSystem, glob } from "https://deno.land/x/quickr@0.6.56/main/file_system.js" + console.log(FileSystem.makeRelativePath({ + from: Deno.args[0], + to: Deno.args[1], + })) +' -- "$(dirname "$target_filepath")" "$(dirname "$existing_filepath")" )" __temp_var__relative_path="$__temp_var__relative_part/$(basename "$existing_filepath")" # link using the relative path if [ -d "$existing_filepath" ] diff --git a/settings/fornix_core b/settings/fornix_core index d8a31b8..7199ef1 100644 --- a/settings/fornix_core +++ b/settings/fornix_core @@ -97,30 +97,21 @@ then # # run all the #establish_extension.sh files # - if [ "$__temp_var__realpath_works" = "true" ] - then - # this loop is so stupidly complicated because of many inherent-to-shell reasons, for example: https://stackoverflow.com/questions/13726764/while-loop-subshell-dilemma-in-bash - for_each_item_in="$FORNIX_FOLDER/settings/extensions/"; [ -z "$__NESTED_WHILE_COUNTER" ] && __NESTED_WHILE_COUNTER=0;__NESTED_WHILE_COUNTER="$((__NESTED_WHILE_COUNTER + 1))"; trap 'rm -rf "$__temp_var__temp_folder"' EXIT; __temp_var__temp_folder="$(mktemp -d)"; mkfifo "$__temp_var__temp_folder/pipe_for_while_$__NESTED_WHILE_COUNTER"; (find "$for_each_item_in" -maxdepth 1 ! -path . -print0 2>/dev/null | sort -z > "$__temp_var__temp_folder/pipe_for_while_$__NESTED_WHILE_COUNTER" &); while read -d $'\0' each - do - __temp_var__file_path="$each/#establish_extension.sh" - # check if file exists - if [ -f "$__temp_var__file_path" ] - then - __fornix_debug_message " loading: $__temp_var__file_path" - # tell the scripts what file they're inside of - export __THIS_FORNIX_EXTENSION_FILEPATH__="$__temp_var__file_path" - export __THIS_FORNIX_EXTENSION_FOLDERPATH__="$each" - . "$__temp_var__file_path" - fi - unset __temp_var__file_path - done < "$__temp_var__temp_folder/pipe_for_while_$__NESTED_WHILE_COUNTER";__NESTED_WHILE_COUNTER="$((__NESTED_WHILE_COUNTER - 1))" - else - echo 'Warning: skipping establish_extension' - echo ' It looks like either you dont have a `realpath` command or the realpath' - echo ' you do have doesnt support --relative-to= and/or --canonicalize-missing' - echo ' this `'"$(which realpath)"'` is what I get after running `which realpath`' - echo " because realpath isn't working, I will be skipping the establish_extension/ " - fi + # this loop is so stupidly complicated because of many inherent-to-shell reasons, for example: https://stackoverflow.com/questions/13726764/while-loop-subshell-dilemma-in-bash + for_each_item_in="$FORNIX_FOLDER/settings/extensions/"; [ -z "$__NESTED_WHILE_COUNTER" ] && __NESTED_WHILE_COUNTER=0;__NESTED_WHILE_COUNTER="$((__NESTED_WHILE_COUNTER + 1))"; trap 'rm -rf "$__temp_var__temp_folder"' EXIT; __temp_var__temp_folder="$(mktemp -d)"; mkfifo "$__temp_var__temp_folder/pipe_for_while_$__NESTED_WHILE_COUNTER"; (find "$for_each_item_in" -maxdepth 1 ! -path . -print0 2>/dev/null | sort -z > "$__temp_var__temp_folder/pipe_for_while_$__NESTED_WHILE_COUNTER" &); while read -d $'\0' each + do + __temp_var__file_path="$each/#establish_extension.sh" + # check if file exists + if [ -f "$__temp_var__file_path" ] + then + __fornix_debug_message " loading: $__temp_var__file_path" + # tell the scripts what file they're inside of + export __THIS_FORNIX_EXTENSION_FILEPATH__="$__temp_var__file_path" + export __THIS_FORNIX_EXTENSION_FOLDERPATH__="$each" + . "$__temp_var__file_path" + fi + unset __temp_var__file_path + done < "$__temp_var__temp_folder/pipe_for_while_$__NESTED_WHILE_COUNTER";__NESTED_WHILE_COUNTER="$((__NESTED_WHILE_COUNTER - 1))" unset __temp_var__realpath_works __fornix_debug_message " Finished running the #establish_extension.sh in every folder inside settings/extensions/"