Add script to generate Obsidian Livesync local.ini

file
This commit is contained in:
Christopher
2023-11-05 19:03:00 -06:00
parent 826b4770ad
commit e97002d727
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# Run command
```bash
bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/generate-obsidian-livesync-local-ini/run.sh)"
```

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Ask the user for the desired config location
read -p "Enter the location to save the config (default: /DATA/AppData/big-bear-obsidian-livesync/data/local.ini): " location
# If the user doesn't provide a location, default to the specified path
if [ -z "$location" ]; then
location="/DATA/AppData/big-bear-obsidian-livesync/data/local.ini"
fi
# Check if the config file already exists
if [ -e "$location" ]; then
read -p "Warning: $location already exists. Do you want to replace it? (yes/no) " replace
if [[ "$replace" != "yes" ]]; then
echo "Operation cancelled."
exit 1
fi
fi
# Create the directory (and its parents) if it doesn't exist
mkdir -p "$(dirname "$location")"
# Download the file from the given URL and save it to the specified location
curl -L "https://raw.githubusercontent.com/bigbeartechworld/big-bear-casaos/master/Apps/obsidian-livesync/local.ini" -o "$location"
# Confirm to the user
echo "Config saved to $location"