2024-01-13 10:01:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
clear
|
|
|
|
|
|
|
|
export BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
2024-01-13 11:03:37 +00:00
|
|
|
export NU_CONFIG_DIR=${BASE}/nuscripts/config
|
|
|
|
|
|
|
|
|
|
|
|
#keys used to see how to checkout code, don't remove
|
|
|
|
if [[ -z "$SSH_AUTH_SOCK" ]]; then
|
|
|
|
echo " - SSH agent is not running."
|
|
|
|
export sshkeys=''
|
|
|
|
else
|
|
|
|
export sshkeys=$(ssh-add -l)
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
function gitcheck {
|
|
|
|
# Check if Git email is set
|
|
|
|
if [ -z "$(git config user.email)" ]; then
|
|
|
|
echo "Git email is not set."
|
|
|
|
read -p "Enter your Git email: " git_email
|
|
|
|
git config --global user.email "$git_email"
|
|
|
|
else
|
|
|
|
echo "Git email is set to: $(git config user.email)"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function github_keyscan {
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
if ! grep github.com ~/.ssh/known_hosts > /dev/null
|
|
|
|
then
|
|
|
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
|
|
fi
|
|
|
|
git config --global pull.rebase false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function nuscript_get {
|
|
|
|
gitcheck
|
|
|
|
github_keyscan
|
|
|
|
export DIR_CODE=$BASE/code
|
|
|
|
mkdir -p $DIR_CODE
|
|
|
|
if [[ -d "$DIR_CODE/nuscripts" ]]
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
else
|
|
|
|
pushd $DIR_CODE 2>&1 >> /dev/null
|
|
|
|
if [[ -z "$sshkeys" ]]; then
|
|
|
|
git clone --depth 1 --no-single-branch https://git.ourworld.tf/despiegk/nuscripts.git
|
|
|
|
else
|
|
|
|
git clone --depth 1 --no-single-branch git@git.ourworld.tf:despiegk/nuscripts.git
|
|
|
|
fi
|
|
|
|
popd 2>&1 >> /dev/null
|
|
|
|
fi
|
|
|
|
rm -f $BASE/nuscripts
|
|
|
|
ln -s "$DIR_CODE/nuscripts" $BASE/nuscripts
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-13 10:01:54 +00:00
|
|
|
|
|
|
|
# run_hero() {
|
|
|
|
# hero 2>&1 > /dev/null
|
|
|
|
# exit_status=$?
|
|
|
|
# if [ $exit_status -ne 0 ]; then
|
|
|
|
# echo "Failed to start Hero Cmd."
|
|
|
|
# echo "If you're on macOS and encountering security restrictions."
|
|
|
|
# echo "You can do this in System Preferences > Security & Privacy."
|
|
|
|
# echo "Under the Privacy tab, add the Terminal and other Apps from this Distro"
|
|
|
|
# echo "to the list of applications with Access."
|
|
|
|
# fi
|
|
|
|
# }
|
|
|
|
|
|
|
|
# run_nu() {
|
|
|
|
# nu -h 2>&1 > /dev/null
|
|
|
|
# exit_status=$?
|
|
|
|
# if [ $exit_status -ne 0 ]; then
|
|
|
|
# echo "Failed to start Nushell."
|
|
|
|
# fi
|
|
|
|
# }
|
|
|
|
|
|
|
|
# run_mycelium() {
|
|
|
|
# mycelium -h 2>&1 > /dev/null
|
|
|
|
# exit_status=$?
|
|
|
|
# if [ $exit_status -ne 0 ]; then
|
|
|
|
# echo "Failed to start Nushell."
|
|
|
|
# echo "If you're on macOS and encountering security restrictions."
|
|
|
|
# echo "You can do this in System Preferences > Security & Privacy."
|
|
|
|
# echo "Under the Privacy tab, add the Terminal and other Apps from this Distro"
|
|
|
|
# echo "to the list of applications with Access."
|
|
|
|
# fi
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
|
|
# run_hero
|
|
|
|
# run_nu
|
|
|
|
# run_mycelium
|
|
|
|
|
|
|
|
cd ${BASE}
|
2024-01-13 11:03:37 +00:00
|
|
|
|
|
|
|
nuscript_get
|
|
|
|
|
|
|
|
nu --config nuscripts/config/config.nu --env-config nuscripts/config/env.nu -e 'source nuscripts/load.nu; $env.PATH = (paths_nix)'
|