2024-01-30 07:42:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-02-16 10:47:05 +00:00
|
|
|
set -e -o pipefail
|
|
|
|
|
|
|
|
check_git_tag() {
|
|
|
|
local repo_path="$1"
|
|
|
|
local target_tag="$2"
|
|
|
|
|
|
|
|
# Change directory to the specified Git repository
|
|
|
|
pushd "$repo_path" > /dev/null 2>&1
|
2024-02-16 10:51:55 +00:00
|
|
|
# shellcheck disable=SC2181
|
2024-02-16 10:47:05 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error: Failed to change directory to $repo_path"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get the current Git tag
|
2024-02-16 10:51:55 +00:00
|
|
|
local current_tag
|
|
|
|
current_tag=$(git describe --tags --exact-match 2>/dev/null)
|
2024-02-16 10:47:05 +00:00
|
|
|
|
|
|
|
# Restore the original directory
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
|
|
|
|
# Check if the current tag is 2.0
|
|
|
|
if [ "$current_tag" = "$target_tag" ]; then
|
|
|
|
echo "Current Git tag in $repo_path is $target_tag"
|
|
|
|
else
|
|
|
|
echo "Error: Current Git tag in $repo_path is not $target_tag"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-02-13 10:23:29 +00:00
|
|
|
|
2024-01-30 07:42:22 +00:00
|
|
|
|
2024-02-13 10:23:29 +00:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Usage: $0 <democlan>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
democlan="$1"
|
2024-01-30 07:42:22 +00:00
|
|
|
|
2024-02-16 10:47:34 +00:00
|
|
|
check_git_tag "$democlan" "v2.2"
|
2024-02-13 10:23:29 +00:00
|
|
|
|
2024-02-16 10:51:55 +00:00
|
|
|
check_git_tag "." "v2.3"
|
2024-02-16 10:47:05 +00:00
|
|
|
|
|
|
|
rm -rf ~/.config/clan
|
|
|
|
|
|
|
|
clan history add "clan://$democlan#localsend-wayland1"
|
2024-01-30 07:42:22 +00:00
|
|
|
|
|
|
|
clear
|
|
|
|
cat << EOF
|
|
|
|
Open up this link in a browser:
|
2024-02-16 10:47:05 +00:00
|
|
|
"clan://$democlan#localsend-wayland2"
|
2024-01-30 07:42:22 +00:00
|
|
|
EOF
|