Skip to content

Commit

Permalink
v0.4.1
Browse files Browse the repository at this point in the history
bug fixes: osascript
version & Swift checks for alisma
  • Loading branch information
JayBrown committed Oct 23, 2020
1 parent 56f8a8a commit 5baca4e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Linker_QuickAction.sh → Linker_workflow.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/zsh
# shellcheck shell=bash

# Linker Finder QuickAction (workflow)
# Linker Finder workflow (QuickAction or Service)
# version 1.0.1

export LANG=en_US.UTF-8
Expand Down
7 changes: 4 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Linker is a macOS shell script and Finder QuickAction to create relative or absolute symbolic links, hard links, Finder aliases, Bookmark files, file clones or legacy file copies

Latest release: https://github.com/JayBrown/Linker/releases/latest
Successfully tested on: macOS 10.15.7 (Catalina)
Not working on: OS X 10.9.5 (Mavericks)
Successfully tested on: macOS 10.15.7 (Catalina) & macOS 10.13.6 (High Sierra)

* install linker shell script into your $PATH

Expand All @@ -19,7 +18,9 @@ Not working on: OS X 10.9.5 (Mavericks)
* execute the following, if the script doesn't run: chmod +x ./linker

* Mojave & later: install QuickAction workflow with Automator Installer
* on older systems the QuickAction format is either not supported or might not work properly as a Service workflow, and you need to create your own Service workflow in Automator
* High Sierra & earlier: install the Service workflow with Automator Installer

* Mojave 10.14.3 and earlier (optional): install the Swift 5 Runtime Support for Command Line Tools: https://support.apple.com/kb/DL1998?locale=en_US

In Finder you can just use the QuickAction from the contextual menu (or the Service on older systems).

Expand Down
78 changes: 54 additions & 24 deletions linker
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/zsh
# shellcheck shell=bash

# Linker v0.4
# Linker v0.4.1

export LANG=en_US.UTF-8
export SYSTEM_VERSION_COMPAT=0
Expand All @@ -11,21 +11,41 @@ uiprocess="Linker"
procid="local.lcars.Linker"

# check system version
swiftlib="/usr/lib/swift/libswiftCore.dylib"
sysvers=$(sw_vers -productVersion)
doublealias=false
noalisma=false
noapfs=false
vmaj=$(echo "$sysvers" | awk -F"." '{print $1}')
if [[ $vmaj -lt 11 ]] ; then
vmin=$(echo "$sysvers" | awk -F"." '{print $2}')
if [[ $vmin -lt 13 ]] ; then # no APFS support
noapfs=true
if [[ $vmin -eq 12 ]] ; then
vfix=$(echo "$sysvers" | awk -F"." '{print $3}')
if [[ $vfix -lt 6 ]] ; then # potentially buggy support for new Alias format: needs to be separated from Bookmark file
doublealias=true
vfix=$(echo "$sysvers" | awk -F"." '{print $3}')
if [[ $vmin -eq 14 ]] ; then
if [[ $vfix -le 3 ]] ; then # Mojave 10.14.3 and earlier: needs Swift libraries for alisma
if ! [[ -f "$swiftlib" ]] ; then
noalisma=true
fi
elif [[ $vmin -lt 12 ]] ; then # old Alias format: needs to be separated from Bookmark file
doublealias=true
fi
elif [[ $vmin -eq 13 ]] ; then # High Sierra: needs Swift libraries for alisma
if ! [[ -f "$swiftlib" ]] ; then
noalisma=true
fi
elif [[ $vmin -le 12 ]] ; then # Sierra and earlier
noapfs=true # no APFS support on Sierra and earlier
if [[ $vmin -ge 11 ]] ; then # Swift libraries needed for: El Capitan & Sierra
if ! [[ -f "$swiftlib" ]] ; then
noalisma=true
else # Swift libraries are present
if [[ $vmin -eq 12 ]] ; then
if [[ $vfix -lt 6 ]] ; then # potentially buggy support for new Alias format: needs to be separated from Bookmark file
doublealias=true
fi
elif [[ $vmin -eq 11 ]] ; then # old Alias format: needs to be separated from Bookmark file
doublealias=true
fi
fi
else # Yosemite and earlier: no Swift library & alisma support
noalisma=true
fi
fi
fi
Expand Down Expand Up @@ -184,10 +204,14 @@ elif [[ $1 == "-s" ]] ; then
cli=true
shift
elif [[ $1 == "-b" ]] ; then
if $doublealias ; then
bookmark=true
else
if $noalisma ; then
finderalias=true
else
if $doublealias ; then
bookmark=true
else
finderalias=true
fi
fi
cli=true
shift
Expand Down Expand Up @@ -3486,26 +3510,32 @@ fi

# export additional path & check for availability of alisma
export PATH=$PATH:"$bindir"
xalisma=true
if ! command -v alisma &>/dev/null ; then
chmod +x "$bindir/alisma" 2>/dev/null
if $noalisma ; then
xalisma=false
else
xalisma=true
if ! command -v alisma &>/dev/null ; then
xalisma=false
chmod +x "$bindir/alisma" 2>/dev/null
if ! command -v alisma &>/dev/null ; then
xalisma=false
else
if ! alisma -h | head -1 | grep "^alisma v[1-9] usage:$" &>/dev/null ; then
xalisma=false
fi
fi
else
if ! alisma -h | head -1 | grep "^alisma v[1-9] usage:$" &>/dev/null ; then
xalisma=false
fi
fi
else
if ! alisma -h | head -1 | grep "^alisma v[1-9] usage:$" &>/dev/null ; then
xalisma=false
fi
fi
if $cli ; then # standard alias files can always be created via Finder
if $bookmark && ! $xalisma ; then
_sysbeep &
_notify "⚠️ Bookmark files unsupported!" "alisma CLI is missing!"
exit
if $bookmark ; then
if $noalisma || ! $xalisma ; then
_sysbeep &
_notify "⚠️ Bookmark files unsupported!" "alisma CLI is missing!"
exit
fi
fi
fi

Expand Down

0 comments on commit 5baca4e

Please sign in to comment.