Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

A36 Feature: Use ternary expressions in the installer #28

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.ab
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ if $echo \$?$ == '0' {
$mv target/aarch64-unknown-linux-musl/release/amber target/release/amber_linux_aarch64$
$mv target/x86_64-apple-darwin/release/amber target/release/amber_macos_x86_64$
$mv target/x86_64-unknown-linux-musl/release/amber target/release/amber_linux_x86_64$
# Recompile installer scripts
$cargo run -- setup/install.ab setup/install.sh$
$cargo run -- setup/uninstall.ab setup/uninstall.sh$
} else {
$echo "Please run this command in the project root directory"$
}
22 changes: 6 additions & 16 deletions setup/install.ab
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@ let target = 'amber'
let tag = 'v0.1.1-alpha'
let place = '/opt/amber'

# Detect OS type
let arch = ''
let os = ''

# Determine OS type
if $uname -s$ == 'Darwin' {
os = 'macos'
}
else {
os = 'linux'
}
let os = $uname -s$ == 'Darwin'
then 'macos'
else 'linux'

# Determine architecture
if $uname -m$ == 'arm64' {
arch = 'aarch64'
}
else {
arch = 'x86_64'
}
let arch = $uname -m$ == 'arm64'
then 'aarch64'
else 'x86_64'

# Set the download link
let url = 'https://github.com/Ph0enixKM/{name}/releases/download/{tag}/amber_{os}_{arch}'
Expand Down
14 changes: 2 additions & 12 deletions setup/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@ name="AmberNative";
target="amber";
tag="v0.1.1-alpha";
place="/opt/amber";
arch="";
os="";
if [ $([ "_$(uname -s)" != "_Darwin" ]; echo $?) != 0 ]; then
os="macos"
else
os="linux"
fi;
if [ $([ "_$(uname -m)" != "_arm64" ]; echo $?) != 0 ]; then
arch="aarch64"
else
arch="x86_64"
fi;
os=$(if [ $([ "_$(uname -s)" != "_Darwin" ]; echo $?) != 0 ]; then echo "macos"; else echo "linux"; fi);
arch=$(if [ $([ "_$(uname -m)" != "_arm64" ]; echo $?) != 0 ]; then echo "aarch64"; else echo "x86_64"; fi);
url="https://github.com/Ph0enixKM/${name}/releases/download/${tag}/amber_${os}_${arch}";
test -d "${place}" > /dev/null;
if [ $([ "_$(echo $?)" != "_0" ]; echo $?) != 0 ]; then
Expand Down