Created
August 31, 2024 19:17
-
-
Save adamshostack/4fac61be8fff40a0ea9c597c7fd7d423 to your computer and use it in GitHub Desktop.
Installing Bricklink Studio without admin rights
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkgutil --expand-full Studio+2.0.pkg studio | |
cd studio/Studio_2.0.pkg/Payload/Applications | |
mv Studio\ 2.0/ /Applications/ |
Because I'm having a conversation on mastodon about enabling "strict mode" with -euo
, here's the code:
#!/bin/bash
#
# delete application
#
studio_path="$DSTROOT/Applications/Studio 2.0"
home=$HOME
echo "applications path="$studio_path
echo "home path="$home
if [ -d "$studio_path" ]
then
# delete all from studio path except "ldraw"
sudo rm -rf "${studio_path}/" -mindepth 1 -maxdepth 1 ! -name "ldraw" -exec rm -rf {} +
# delete all from studio/ldraw path except "Custom Parts"
sudo find "${studio_path}/ldraw" -mindepth 1 -maxdepth 1 ! -name "Custom Parts" -exec rm -rf {} +
fi
#
# delete cached files
#
cachedLibPath="$home/.local/share/Stud.io/cachedLibraryPath.txt"
cachedMetaInfoPath="$home/.local/share/Stud.io/BLBrickMetaInfo"
cachedNewPartsPath="$home/.local/share/Stud.io/NewParts"
unityPref="$home/Library/Preferences/com.BrickLink.Studio.plist"
array=("$cachedLibPath" "$unityPref" "$cachedMetaInfoPath" "$cachedNewPartsPath")
for path in ${array[@]}
do
if [ -f $path ] || [ -d $path ]
then
sudo rm -rf $path
fi
done
exit 0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The app seems to have no reasonable reason to run with admin privileges, and it has code (in scripts/preinstall) like this:
I don't like the unprotected
$home
(it should be${home}
and if there's an error, we end up withsudo rm -rf
on the path? No thank you!!