-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: migrate script #1852
base: develop
Are you sure you want to change the base?
feat: migrate script #1852
Conversation
WalkthroughThe pull request introduces a new migration script Changes
Sequence DiagramsequenceDiagram
participant User
participant Script
participant Runtipi Service
participant Applications
User->>Script: Run migration script
Script->>Script: Check root privileges
Script->>Script: Verify migration prerequisites
Script-->>User: Warn about data backup
User->>Script: Confirm
Script->>Applications: Stop all applications
Script->>Runtipi Service: Stop service
Script->>Script: Create new directory structure
Script->>Script: Move applications and data
Script->>Script: Clean up repositories
Script->>Runtipi Service: Update to nightly build
Script-->>User: Migration complete
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🧹 Nitpick comments (2)
scripts/update-3.0.0-to-4.0.0.sh (2)
1-4
: Enhance error handling with cleanup trapWhile the error handling flags are good, consider adding a cleanup trap to ensure proper cleanup if the script fails midway.
#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail + +cleanup() { + # Start Runtipi if it was stopped during script execution + if [[ -f ".migration_in_progress" ]]; then + echo "Error occurred. Attempting to restart Runtipi..." + ./runtipi-cli start >/dev/null 2>&1 || true + rm -f ".migration_in_progress" + fi +} + +trap cleanup ERR EXIT
12-13
: Enhance user guidance and documentationThe welcome message should provide more context and guidance.
-# Welcome message -echo -e "👋 Welcome to the Runtipi migration script. It will automatically update everything to work with version ${Green}4.0.0${ColorOff}\n" +# Welcome message and information +cat << EOF +👋 Welcome to the Runtipi migration script v4.0.0 + +This script will: +1. Verify system requirements and current installation +2. Create a complete backup of your current installation +3. Stop all running applications +4. Migrate applications to the new directory structure +5. Update Runtipi to version 4.0.0 + +Requirements: +- Current version must be 3.0.x +- At least $(df -h . | awk 'NR==2 {print $4}') of free disk space +- Network connectivity to GitHub +- Root privileges + +A backup will be created before any changes are made. +In case of failure, you can restore from the backup directory. + +EOF
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
scripts/update-3.0.0-to-4.0.0.sh
(1 hunks)scripts/update-3.x-to-4.0.0.sh
(0 hunks)
💤 Files with no reviewable changes (1)
- scripts/update-3.x-to-4.0.0.sh
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/update-3.0.0-to-4.0.0.sh
[warning] 16-16: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[warning] 22-22: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[warning] 28-28: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[error] 42-42: Iterating over ls output is fragile. Use globs.
(SC2045)
[error] 54-54: Iterating over ls output is fragile. Use globs.
(SC2045)
[error] 72-72: Iterating over ls output is fragile. Use globs.
(SC2045)
[warning] 73-73: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
#!/usr/bin/env bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# Colors | ||
Red='\e[31m' | ||
Green='\e[32m' | ||
Yellow='\e[33m' | ||
ColorOff='\e[0m' | ||
|
||
# Welcome message | ||
echo -e "👋 Welcome to the Runtipi migration script. It will automatically update everything to work with version ${Green}4.0.0${ColorOff}\n" | ||
|
||
# Check if running as root | ||
if [[ "$EUID" -ne 0 ]] then | ||
echo -e "❌ ${Red}Root is required for this script!${ColorOff}" | ||
exit 1 | ||
fi | ||
|
||
# Verify app data | ||
if [[ -d "app-data/app-data" ]] then | ||
echo -e "❌ ${Red}You have an additional app-data folder, the script cannot continue with this folder, please seek help in our Discord or Forums for a guide on how to fix the issue.${ColorOff}" | ||
exit 1 | ||
fi | ||
|
||
# Check if already migrated | ||
if [[ -d "apps/1" ]] then | ||
echo -e "❌ ${Red}You have already migrated your apps, if you haven't updated yet, run ${Green}./runtipi-cli update latest${ColorOff}" | ||
exit 1 | ||
fi | ||
|
||
# Backups warning | ||
echo -e "⚠️ ${Yellow}Warning:${ColorOff} Make sure you have backed up your data before continuing, if something goes wrong during the migration process, you can risk losing important data! You can press Ctrl+C to cancel now if you need to backup\n" | ||
echo -e "⏳ Starting in 10 seconds...\n" | ||
|
||
sleep 10s | ||
|
||
# Get all apps | ||
echo -e "📦 Detecting apps..." | ||
|
||
for app in $(ls apps); do | ||
echo -e "📦 Found app: ${Green}$app${ColorOff}" | ||
done | ||
|
||
echo -e "\n⚠️ ${Yellow}Warning:${ColorOff} If an app is missing from the list above, please cancel the script immediately with Ctrl+C and seek help in our Discord or Forums\n" | ||
echo -e "⏳ Starting in 10 seconds...\n" | ||
|
||
sleep 10s | ||
|
||
# Stop apps | ||
echo -e "🛑 Stopping apps..." | ||
|
||
for app in $(ls apps); do | ||
echo -e "🛑 Stopping app: ${Green}$app${ColorOff}" | ||
./runtipi-cli app stop $app >/dev/null 2>&1 | ||
done | ||
|
||
# Stop runtipi | ||
echo -e "\n🛑 Stopping Runtipi...\n" | ||
|
||
./runtipi-cli stop >/dev/null 2>&1 | ||
|
||
# Moving apps | ||
echo -e "⏭️ Moving apps..." | ||
|
||
mkdir -p apps/1 | ||
mkdir -p app-data/1 | ||
mkdir -p user-config/1 | ||
mkdir -p backups/1 | ||
|
||
for app in $(ls apps); do | ||
if [[ $app == 1 ]] then | ||
continue | ||
fi | ||
echo -e "⏭️ Moving app: ${Green}$app${ColorOff}" | ||
mv apps/$app apps/1/$app | ||
mv app-data/$app app-data/1/$app | ||
if [[ -d "user-config/$app" ]]; then | ||
mv user-config/$app user-config/1/$app | ||
fi | ||
if [[ -d "backups/$app" ]]; then | ||
mv backups/$app backups/1/$app | ||
fi | ||
done | ||
|
||
# Clean repos | ||
echo -e "\n🧹 Cleaning repos...\n" | ||
|
||
rm -rf repos/* | ||
|
||
# Update runtipi | ||
echo -e "🔄 Updating Runtipi...\n" | ||
|
||
./runtipi-cli update nightly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add essential pre-flight checks
The script should verify system requirements and current state before proceeding.
Add these checks after the root verification:
# Check current version
current_version=$(./runtipi-cli version)
if [[ ! "$current_version" =~ ^3\.0\.[0-9]+$ ]]; then
echo -e "❌ ${Red}This script is only for migrating from version 3.0.x to 4.0.0${ColorOff}"
echo -e "Current version: ${current_version}"
exit 1
fi
# Check available disk space (need at least 2x current size for backup)
current_size=$(du -s . | awk '{print $1}')
available_space=$(df -k . | awk 'NR==2 {print $4}')
if (( available_space < current_size * 2 )); then
echo -e "❌ ${Red}Insufficient disk space for backup and migration${ColorOff}"
echo -e "Required: $(( current_size * 2 / 1024 ))MB, Available: $(( available_space / 1024 ))MB"
exit 1
fi
# Check network connectivity
if ! curl -s --connect-timeout 5 https://api.github.com >/dev/null; then
echo -e "❌ ${Red}No network connectivity to GitHub${ColorOff}"
echo "Network access is required for updating Runtipi"
exit 1
fi
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 16-16: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[warning] 22-22: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[warning] 28-28: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[error] 42-42: Iterating over ls output is fragile. Use globs.
(SC2045)
[error] 54-54: Iterating over ls output is fragile. Use globs.
(SC2045)
[error] 72-72: Iterating over ls output is fragile. Use globs.
(SC2045)
[warning] 73-73: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
if [[ "$EUID" -ne 0 ]] then | ||
echo -e "❌ ${Red}Root is required for this script!${ColorOff}" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix syntax error in root check condition
There's a syntax error in the if statement that needs to be fixed.
-if [[ "$EUID" -ne 0 ]] then
+if [[ "$EUID" -ne 0 ]]; then
echo -e "❌ ${Red}Root is required for this script!${ColorOff}"
exit 1
fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if [[ "$EUID" -ne 0 ]] then | |
echo -e "❌ ${Red}Root is required for this script!${ColorOff}" | |
exit 1 | |
fi | |
if [[ "$EUID" -ne 0 ]]; then | |
echo -e "❌ ${Red}Root is required for this script!${ColorOff}" | |
exit 1 | |
fi |
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 16-16: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
echo -e "📦 Detecting apps..." | ||
|
||
for app in $(ls apps); do | ||
echo -e "📦 Found app: ${Green}$app${ColorOff}" | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace unsafe ls usage with glob expansion
Using ls
for iteration is fragile and can break with special characters in app names.
echo -e "📦 Detecting apps..."
-for app in $(ls apps); do
+shopt -s nullglob
+for app in apps/*; do
+ app=${app#apps/} # Remove 'apps/' prefix
+ [[ -d "apps/$app" ]] || continue # Skip if not a directory
echo -e "📦 Found app: ${Green}$app${ColorOff}"
done
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
echo -e "📦 Detecting apps..." | |
for app in $(ls apps); do | |
echo -e "📦 Found app: ${Green}$app${ColorOff}" | |
done | |
echo -e "📦 Detecting apps..." | |
shopt -s nullglob | |
for app in apps/*; do | |
app=${app#apps/} # Remove 'apps/' prefix | |
[[ -d "apps/$app" ]] || continue # Skip if not a directory | |
echo -e "📦 Found app: ${Green}$app${ColorOff}" | |
done |
🧰 Tools
🪛 Shellcheck (0.10.0)
[error] 42-42: Iterating over ls output is fragile. Use globs.
(SC2045)
# Verify app data | ||
if [[ -d "app-data/app-data" ]] then | ||
echo -e "❌ ${Red}You have an additional app-data folder, the script cannot continue with this folder, please seek help in our Discord or Forums for a guide on how to fix the issue.${ColorOff}" | ||
exit 1 | ||
fi | ||
|
||
# Check if already migrated | ||
if [[ -d "apps/1" ]] then | ||
echo -e "❌ ${Red}You have already migrated your apps, if you haven't updated yet, run ${Green}./runtipi-cli update latest${ColorOff}" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix syntax errors and enhance pre-migration validation
There are syntax errors in the if statements and the validation could be more comprehensive.
-if [[ -d "app-data/app-data" ]] then
+if [[ -d "app-data/app-data" ]]; then
echo -e "❌ ${Red}You have an additional app-data folder, the script cannot continue with this folder, please seek help in our Discord or Forums for a guide on how to fix the issue.${ColorOff}"
exit 1
fi
-if [[ -d "apps/1" ]] then
+if [[ -d "apps/1" ]]; then
echo -e "❌ ${Red}You have already migrated your apps, if you haven't updated yet, run ${Green}./runtipi-cli update latest${ColorOff}"
exit 1
fi
+# Verify required directories exist
+for dir in "apps" "app-data" "user-config" "backups"; do
+ if [[ ! -d "$dir" ]]; then
+ echo -e "❌ ${Red}Required directory '$dir' not found!${ColorOff}"
+ exit 1
+ fi
+done
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 22-22: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
[warning] 28-28: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
# Clean repos | ||
echo -e "\n🧹 Cleaning repos...\n" | ||
|
||
rm -rf repos/* | ||
|
||
# Update runtipi | ||
echo -e "🔄 Updating Runtipi...\n" | ||
|
||
./runtipi-cli update nightly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add verification steps to cleanup and update process
The cleanup and update process needs safety checks and verification.
echo -e "\n🧹 Cleaning repos...\n"
+if [[ -d "repos" ]]; then
+ # Backup repos directory
+ mv repos "repos_backup_${BACKUP_TIMESTAMP}"
+fi
mkdir -p repos
-rm -rf repos/*
echo -e "🔄 Updating Runtipi...\n"
-./runtipi-cli update nightly
+if ! ./runtipi-cli update nightly; then
+ echo -e "${Red}Failed to update Runtipi${ColorOff}"
+ echo -e "Please check the logs and try updating manually with: ${Green}./runtipi-cli update latest${ColorOff}"
+ exit 1
+fi
+
+# Clean up migration marker
+rm -f .migration_in_progress
+
+echo -e "\n✅ ${Green}Migration completed successfully!${ColorOff}"
+echo -e "Backup is available at: ${Green}${BACKUP_DIR}${ColorOff}"
Committable suggestion skipped: line range outside the PR's diff.
# Stop apps | ||
echo -e "🛑 Stopping apps..." | ||
|
||
for app in $(ls apps); do | ||
echo -e "🛑 Stopping app: ${Green}$app${ColorOff}" | ||
./runtipi-cli app stop $app >/dev/null 2>&1 | ||
done | ||
|
||
# Stop runtipi | ||
echo -e "\n🛑 Stopping Runtipi...\n" | ||
|
||
./runtipi-cli stop >/dev/null 2>&1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance app stopping logic with error handling
The current implementation suppresses errors and doesn't verify successful stops.
echo -e "🛑 Stopping apps..."
-for app in $(ls apps); do
+failed_stops=()
+shopt -s nullglob
+for app in apps/*; do
+ app=${app#apps/}
+ [[ -d "apps/$app" ]] || continue
echo -e "🛑 Stopping app: ${Green}$app${ColorOff}"
- ./runtipi-cli app stop $app >/dev/null 2>&1
+ if ! ./runtipi-cli app stop "$app"; then
+ echo -e "${Red}Failed to stop $app${ColorOff}"
+ failed_stops+=("$app")
+ fi
done
+if [[ ${#failed_stops[@]} -gt 0 ]]; then
+ echo -e "${Red}Failed to stop some apps: ${failed_stops[*]}${ColorOff}"
+ echo "Please stop these apps manually and retry the migration"
+ exit 1
+fi
+
echo -e "\n🛑 Stopping Runtipi...\n"
-./runtipi-cli stop >/dev/null 2>&1
+if ! ./runtipi-cli stop; then
+ echo -e "${Red}Failed to stop Runtipi${ColorOff}"
+ exit 1
+fi
+
+# Mark migration in progress for cleanup trap
+touch .migration_in_progress
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# Stop apps | |
echo -e "🛑 Stopping apps..." | |
for app in $(ls apps); do | |
echo -e "🛑 Stopping app: ${Green}$app${ColorOff}" | |
./runtipi-cli app stop $app >/dev/null 2>&1 | |
done | |
# Stop runtipi | |
echo -e "\n🛑 Stopping Runtipi...\n" | |
./runtipi-cli stop >/dev/null 2>&1 | |
# Stop apps | |
echo -e "🛑 Stopping apps..." | |
failed_stops=() | |
shopt -s nullglob | |
for app in apps/*; do | |
app=${app#apps/} | |
[[ -d "apps/$app" ]] || continue | |
echo -e "🛑 Stopping app: ${Green}$app${ColorOff}" | |
if ! ./runtipi-cli app stop "$app"; then | |
echo -e "${Red}Failed to stop $app${ColorOff}" | |
failed_stops+=("$app") | |
fi | |
done | |
if [[ ${#failed_stops[@]} -gt 0 ]]; then | |
echo -e "${Red}Failed to stop some apps: ${failed_stops[*]}${ColorOff}" | |
echo "Please stop these apps manually and retry the migration" | |
exit 1 | |
fi | |
echo -e "\n🛑 Stopping Runtipi...\n" | |
if ! ./runtipi-cli stop; then | |
echo -e "${Red}Failed to stop Runtipi${ColorOff}" | |
exit 1 | |
fi | |
# Mark migration in progress for cleanup trap | |
touch .migration_in_progress |
🧰 Tools
🪛 Shellcheck (0.10.0)
[error] 54-54: Iterating over ls output is fragile. Use globs.
(SC2045)
# Moving apps | ||
echo -e "⏭️ Moving apps..." | ||
|
||
mkdir -p apps/1 | ||
mkdir -p app-data/1 | ||
mkdir -p user-config/1 | ||
mkdir -p backups/1 | ||
|
||
for app in $(ls apps); do | ||
if [[ $app == 1 ]] then | ||
continue | ||
fi | ||
echo -e "⏭️ Moving app: ${Green}$app${ColorOff}" | ||
mv apps/$app apps/1/$app | ||
mv app-data/$app app-data/1/$app | ||
if [[ -d "user-config/$app" ]]; then | ||
mv user-config/$app user-config/1/$app | ||
fi | ||
if [[ -d "backups/$app" ]]; then | ||
mv backups/$app backups/1/$app | ||
fi | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add safety measures and verification to app migration
The current implementation lacks proper backup and verification steps during migration.
echo -e "⏭️ Moving apps..."
+# Create timestamp for backup
+BACKUP_TIMESTAMP=$(date +%Y%m%d_%H%M%S)
+BACKUP_DIR="migration_backup_${BACKUP_TIMESTAMP}"
+
+echo -e "📦 Creating backup in ${Green}${BACKUP_DIR}${ColorOff}"
+mkdir -p "${BACKUP_DIR}"
+cp -r apps app-data user-config backups "${BACKUP_DIR}/"
+
mkdir -p apps/1
mkdir -p app-data/1
mkdir -p user-config/1
mkdir -p backups/1
-for app in $(ls apps); do
- if [[ $app == 1 ]] then
+failed_migrations=()
+shopt -s nullglob
+for app_path in apps/*; do
+ app=${app_path#apps/}
+ [[ -d "$app_path" ]] || continue
+ if [[ $app == "1" ]]; then
continue
fi
echo -e "⏭️ Moving app: ${Green}$app${ColorOff}"
- mv apps/$app apps/1/$app
- mv app-data/$app app-data/1/$app
- if [[ -d "user-config/$app" ]]; then
- mv user-config/$app user-config/1/$app
- fi
- if [[ -d "backups/$app" ]]; then
- mv backups/$app backups/1/$app
+
+ # Move with error checking
+ if ! mv "apps/$app" "apps/1/$app" || \
+ ! mv "app-data/$app" "app-data/1/$app"; then
+ failed_migrations+=("$app")
+ continue
fi
+
+ # Move optional directories if they exist
+ [[ -d "user-config/$app" ]] && mv "user-config/$app" "user-config/1/$app"
+ [[ -d "backups/$app" ]] && mv "backups/$app" "backups/1/$app"
done
+
+if [[ ${#failed_migrations[@]} -gt 0 ]]; then
+ echo -e "${Red}Failed to migrate some apps: ${failed_migrations[*]}${ColorOff}"
+ echo -e "Backup is available at: ${Green}${BACKUP_DIR}${ColorOff}"
+ exit 1
+fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# Moving apps | |
echo -e "⏭️ Moving apps..." | |
mkdir -p apps/1 | |
mkdir -p app-data/1 | |
mkdir -p user-config/1 | |
mkdir -p backups/1 | |
for app in $(ls apps); do | |
if [[ $app == 1 ]] then | |
continue | |
fi | |
echo -e "⏭️ Moving app: ${Green}$app${ColorOff}" | |
mv apps/$app apps/1/$app | |
mv app-data/$app app-data/1/$app | |
if [[ -d "user-config/$app" ]]; then | |
mv user-config/$app user-config/1/$app | |
fi | |
if [[ -d "backups/$app" ]]; then | |
mv backups/$app backups/1/$app | |
fi | |
done | |
# Moving apps | |
echo -e "⏭️ Moving apps..." | |
# Create timestamp for backup | |
BACKUP_TIMESTAMP=$(date +%Y%m%d_%H%M%S) | |
BACKUP_DIR="migration_backup_${BACKUP_TIMESTAMP}" | |
echo -e "📦 Creating backup in ${Green}${BACKUP_DIR}${ColorOff}" | |
mkdir -p "${BACKUP_DIR}" | |
cp -r apps app-data user-config backups "${BACKUP_DIR}/" | |
mkdir -p apps/1 | |
mkdir -p app-data/1 | |
mkdir -p user-config/1 | |
mkdir -p backups/1 | |
failed_migrations=() | |
shopt -s nullglob | |
for app_path in apps/*; do | |
app=${app_path#apps/} | |
[[ -d "$app_path" ]] || continue | |
if [[ $app == "1" ]]; then | |
continue | |
fi | |
echo -e "⏭️ Moving app: ${Green}$app${ColorOff}" | |
# Move with error checking | |
if ! mv "apps/$app" "apps/1/$app" || \ | |
! mv "app-data/$app" "app-data/1/$app"; then | |
failed_migrations+=("$app") | |
continue | |
fi | |
# Move optional directories if they exist | |
[[ -d "user-config/$app" ]] && mv "user-config/$app" "user-config/1/$app" | |
[[ -d "backups/$app" ]] && mv "backups/$app" "backups/1/$app" | |
done | |
if [[ ${#failed_migrations[@]} -gt 0 ]]; then | |
echo -e "${Red}Failed to migrate some apps: ${failed_migrations[*]}${ColorOff}" | |
echo -e "Backup is available at: ${Green}${BACKUP_DIR}${ColorOff}" | |
exit 1 | |
fi |
🧰 Tools
🪛 Shellcheck (0.10.0)
[error] 72-72: Iterating over ls output is fragile. Use globs.
(SC2045)
[warning] 73-73: Use semicolon or linefeed before 'then' (or quote to make it literal).
(SC1010)
It will look something like:
Tested and working on runtipi install.
Summary by CodeRabbit
New Features
Bug Fixes
Chores