From 107317b16dfe9cc6c3a08feed3a473ee6f5ca41d Mon Sep 17 00:00:00 2001 From: Christopher <1289128+dragonfire1119@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:51:51 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20feat(generate-libredesk-config):?= =?UTF-8?q?=20Add=20script=20to=20generate=20LibreDesk=20config=20(#35)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a new script to generate a LibreDesk configuration file. The script prompts the user for the desired location to save the config file, and then downloads the default config from the BigBearTechWorld/big-bear-casaos repository and saves it to the specified location. If the file already exists, the user is asked for confirmation before overwriting it. --- generate-libredesk-config/README.md | 5 +++++ generate-libredesk-config/run.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 generate-libredesk-config/README.md create mode 100644 generate-libredesk-config/run.sh diff --git a/generate-libredesk-config/README.md b/generate-libredesk-config/README.md new file mode 100644 index 0000000..1e87acb --- /dev/null +++ b/generate-libredesk-config/README.md @@ -0,0 +1,5 @@ +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/generate-romm-config/run.sh)" +``` diff --git a/generate-libredesk-config/run.sh b/generate-libredesk-config/run.sh new file mode 100644 index 0000000..711586b --- /dev/null +++ b/generate-libredesk-config/run.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Ask the user for the desired config location +read -p "Enter the location to save the config (default: /DATA/AppData/big-bear-libredesk/config/config.yml): " location + +# If the user doesn't provide a location, default to the specified path +if [ -z "$location" ]; then + location="/DATA/AppData/big-bear-libredesk/config/config.toml" +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/refs/heads/master/Apps/libredesk/config.toml" -o "$location" + +# Confirm to the user +echo "Config saved to $location"