provisioning/distro/from_cargo_nu.sh
2025-09-22 23:11:41 +01:00

40 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
LIST="
nu
nu_plugin_clipboard
nu_plugin_desktop_notifications
nu_plugin_port_scan
nu_plugin_qr_maker
nu_plugin_query
"
set -o allexport
[ -n "$PROVISIONING_ENV" ] && [ -r "$PROVISIONING_ENV" ] && source "$PROVISIONING_ENV"
[ -r "../env-provisioning" ] && source ../env-provisioning
[ -r "env-provisioning" ] && source ./env-provisioning
#[ -r ".env" ] && source .env set
set +o allexport
OS=$(uname | tr '[:upper:]' '[:lower:]')
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
SOURCE_PATH=$HOME/.cargo/bin
export PROVISIONING=${PROVISIONING:-/usr/local/provisioning}
[ ! -d "$PROVISIONING/core/bin/nu/$ARCH-$OS" ] && echo "$PROVISIONING/core/bin/nu/$ARCH-$OS not found" && exit
TARGET_PATH=$PROVISIONING/core/bin/nu/$ARCH-$OS
cd $TARGET_PATH || exit 1
echo "Create nu binaries in $TARGET_PATH from $SOURCE_PATH"
for it in $LIST
do
if [ -r "$SOURCE_PATH/$it" ] ; then
[ -r "$it.gz" ] && rm -f "$it.gz"
cp $HOME/.cargo/bin/$it .
gzip $it
echo "created: $it"
fi
done