-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from boushley/user-only-uninstall
Update uninstall.ab to support user only mode.
- Loading branch information
Showing
5 changed files
with
301 additions
and
123 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { exit, includes } from "std" | ||
|
||
pub fun get_os(): Text { | ||
// Determine OS type | ||
let os_type = $uname -s$ failed { | ||
echo "Failed to determine OS type." | ||
echo "Please try again or use another download method." | ||
exit(1) | ||
} | ||
let os = os_type == "Darwin" | ||
then "macos" | ||
else "linux" | ||
|
||
return os | ||
} | ||
|
||
pub fun get_arch(): Text { | ||
// Determine architecture | ||
let arch_type = $uname -m$ failed { | ||
echo "Failed to determine architecture." | ||
echo "Please try again or use another download method." | ||
exit(1) | ||
} | ||
|
||
let arch = includes(["arm64", "aarch64"], arch_type) | ||
then "aarch64" | ||
else "x86_64" | ||
|
||
return arch | ||
} | ||
|
||
fun get_home(): Text { | ||
let home = $echo \$HOME$ failed { | ||
echo "User installation requested, but unable to retrieve home directory from $HOME environment." | ||
exit(1) | ||
} | ||
if home == "" { | ||
echo "User installation requested, but unable to find home directory." | ||
exit(1) | ||
} | ||
return home | ||
} | ||
|
||
pub fun get_bins_folder(user_only: Bool): Text { | ||
if user_only { | ||
return "{get_home()}/.local/bin" | ||
} else { | ||
return "/usr/local/bin" | ||
} | ||
} | ||
|
||
pub fun get_place(user_only: Bool): Text { | ||
if user_only { | ||
return "{get_home()}/.local/lib/{get_arch()}/amber" | ||
} else { | ||
return "/opt/amber" | ||
} | ||
} |
Oops, something went wrong.