Skip to content

Commit

Permalink
Merge branch 'master' into python
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hykin committed Nov 25, 2023
2 parents 132e03a + 0a84057 commit 9d282e6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
5 changes: 2 additions & 3 deletions settings/extensions/nix/uninstaller_helper
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
fi
39 changes: 15 additions & 24 deletions settings/fornix_core
Original file line number Diff line number Diff line change
Expand Up @@ -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/"

Expand Down

0 comments on commit 9d282e6

Please sign in to comment.