Skip to content

Commit

Permalink
Remove long-deprecated convenience script
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrfv authored Jan 3, 2025
1 parent 10110db commit 6d9bdf7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 195 deletions.
28 changes: 1 addition & 27 deletions convenience-scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
# Convenience Scripts

These scripts allow you to quickly run the latest version of Open Android Backup without having to follow the usage instructions. Work in progress.

## get.openandroidbackup.me

### Deprecated

This convenience script has been deprecated and will stop functioning in April 2024. Please use the official usage instructions instead.

## Usage

You can access the convenience script from this domain. It automatically detects your operating system based on the user agent and serves the correct script.

### Linux or macOS

Run the following command in your terminal:

```bash
curl -fsSL "https://get.openandroidbackup.me/" | bash
```

### Windows

Run the following command in PowerShell:

```powershell
irm "https://get.openandroidbackup.me/" | iex
```
This convenience script is deprecated. Please use the official usage instructions instead.
4 changes: 2 additions & 2 deletions convenience-scripts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<style>body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; background-color: #ebebeb; padding: 1em; }</style>
</head>
<body>
<p>Warning: The Open Android Backup convenience script has been deprecated and will stop functioning in April 2024. Please use the official usage instructions instead. Read the GitHub repository's README for more information.</p>
<p>This is meant to be downloaded and run from a terminal. See <a href="https://github.com/mrrfv/open-android-backup">here</a> for information about Open Android Backup.</p>
<p>Please use the official usage instructions instead. Read the GitHub repository's README for more information.</p>
<p>See <a href="https://github.com/mrrfv/open-android-backup">here</a> for information about Open Android Backup.</p>
</body>
</html>
8 changes: 6 additions & 2 deletions convenience-scripts/invalid_ua.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
echo "Warning: This convenience script has been deprecated and will stop functioning in April 2024. Please use the official usage instructions instead. Read the GitHub repository's README for more information."
echo "Could not detect your operating system based on your user agent. Please run this script in PowerShell on Windows or curl/wget on Linux or macOS, using the default UA."
echo "Please use the official usage instructions instead. Read the GitHub repository's README for more information."

# Sleeping to ensure the user doesn't just ignore the warning
sleep 5

exit 1
89 changes: 2 additions & 87 deletions convenience-scripts/linux_mac.sh
Original file line number Diff line number Diff line change
@@ -1,93 +1,8 @@
#!/bin/bash

echo "Warning: This convenience script has been deprecated and will stop functioning in April 2024. Please use the official usage instructions instead. Read the GitHub repository's README for more information."
echo "Please use the official usage instructions instead. Read the GitHub repository's README for more information."

# Sleeping to ensure the user doesn't just ignore the warning
sleep 5

echo "Detected operating system: Linux or macOS"
echo "If you are running this script in WSL, please run it in Windows instead."
echo "Sleeping for 5 seconds to allow you to cancel..."
sleep 5

echo "Open Android Backup convenience script for Linux and macOS"
echo "This script will install dependencies, download and run the latest release of Open Android Backup."
echo "The script hasn't been fully tested, so feedback is welcome!"
echo ""

warn_untested_os() {
echo "WARNING: This convenience script has not been tested on your operating system. It may not work as expected."
echo "If you encounter any issues, please report them at https://github.com/mrrfv/open-android-backup/issues"
echo "Continuing in 10 seconds..."
sleep 10
}

# Detect OS
if [[ -n "$WSL_DISTRO_NAME" ]]; then
echo "Please run this script from Windows. Running it directly in WSL is unsupported."
exit 1
else
echo "Not running in WSL, continuing..."
fi

echo "Installing dependencies - you may be prompted for your password."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
if which brew >/dev/null 2>&1; then
echo "Homebrew is installed, continuing..."
else
echo "Homebrew is not installed. It is needed to continue. Press Enter to automatically install Homebrew."
read -r # wait for enter key
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install --cask android-platform-tools
brew install p7zip pv bash dialog curl wget unzip
elif [[ -n "$(command -v apt)" ]]; then
# Ubuntu and Debian
sudo apt update && sudo apt install -y p7zip-full adb curl whiptail pv secure-delete wget unzip
elif [[ -n "$(command -v pacman)" ]]; then
# Arch Linux
warn_untested_os
sudo pacman -Syu --noconfirm p7zip curl wget pv bash whiptail adb secure-delete unzip
elif [[ -n "$(command -v dnf)" ]]; then
# Fedora
warn_untested_os
echo "You must first manually add the RPM Sphere and RPM Fusion repositories, see this link for instructions: https://rpmsphere.github.io/"
echo "After adding the repos, press Enter to continue installing dependencies."
read -r # wait for enter key
sudo dnf install p7zip p7zip-plugins adb curl newt pv secure-delete
elif [[ -n "$(command -v zypper)" ]]; then
# openSUSE
warn_untested_os
sudo zypper refresh && sudo zypper install -y p7zip-full curl wget pv bash whiptail android-tools secure-delete unzip
elif [[ -n "$(command -v emerge)" ]]; then
# Gentoo Linux
warn_untested_os
sudo emerge --sync && sudo emerge --ask app-arch/p7zip dev-util/android-tools dev-util/curl net-misc/wget app-arch/unzip app-shells/bash app-misc/dialog app-misc/pv sys-apps/sec
elif [[ -n "$(command -v yum)" ]]; then
# RHEL/CentOS/Oracle Linux/etc.
warn_untested_os
sudo yum update && sudo yum install -y p7zip curl wget pv bash whiptail android-tools secure-delete unzip

else
echo "Unsupported operating system. Follow the regular installation instructions instead."
echo "If you encounter any issues, please report them at https://github.com/mrrfv/open-android-backup/issues"
exit 1
fi

echo "Downloading latest release of Open Android Backup..."
# Download latest release of Open Android Backup and run it.
OAB_DIRECTORY="open_android_backup_conveniencescript_$RANDOM"
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/mrrfv/open-android-backup/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

mkdir -pv $OAB_DIRECTORY &&
cd $OAB_DIRECTORY &&
wget "https://github.com/mrrfv/open-android-backup/releases/download/$LATEST_RELEASE/Open_Android_Backup_${LATEST_RELEASE}_Bundle.zip" &&
unzip "Open_Android_Backup_${LATEST_RELEASE}_Bundle.zip" &&
chmod +x backup.sh &&
echo "Running Open Android Backup..." &&
bash ./backup.sh ;
echo "Cleaning up..." &&
cd .. &&
rm -rf $OAB_DIRECTORY &&
echo "Done!"
exit 1
80 changes: 3 additions & 77 deletions convenience-scripts/windows.ps1
Original file line number Diff line number Diff line change
@@ -1,80 +1,6 @@
echo "Detected operating system: Windows"
echo "Sleeping for 5 seconds to allow you to cancel..."
sleep 5
echo "Please use the official usage instructions instead. Read the GitHub repository's README for more information."

# It makes more sense to put the deprecation warning after the OS detection, since the echo command is different in PowerShell.
Write-Output "Warning: This convenience script has been deprecated and will stop functioning in April 2024. Please use the official usage instructions instead. Read the GitHub repository's README for more information."
# Sleeping to ensure the user doesn't just ignore the warning
sleep 5

Write-Output "Open Android Backup - Windows Convenience Script"
Write-Output "This script lets you use open-android-backup on Windows."
Write-Output "Please remember that this script hasn't been fully tested, and may contain bugs."

$distros = Get-ChildItem -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss" |
ForEach-Object { Get-ItemProperty $_.PsPath } |
Select-Object DistributionName, Version

if ($distros.Count -eq 0) {
Write-Output "No WSL distros found. Please install a distro using 'wsl --install' and try again."
exit
}

$ubuntu = $distros | Where-Object { $_.DistributionName -eq "Ubuntu" }
$debian = $distros | Where-Object { $_.DistributionName -eq "Debian" }

if ($null -ne $ubuntu) {
if ($ubuntu.Version -eq 2) {
Write-Output "Ubuntu is installed and running WSL 2. Using Ubuntu."
$distro = "Ubuntu"
} else {
Write-Output "Ubuntu is installed but running WSL 1. Please convert it to WSL 2."
exit
}
} elseif ($null -ne $debian) {
if ($debian.Version -eq 2) {
Write-Output "Debian is installed and running WSL 2. Using Debian."
$distro = "Debian"
} else {
Write-Output "Debian is installed but running WSL 1. Please convert it to WSL 2."
exit
}
} else {
Write-Output "Neither Ubuntu nor Debian is installed. Please install one of these WSL distros and try again."
exit
}

pause
Write-Output "Updating WSL..."
wsl --update
wsl --shutdown
wsl -d $distro sudo apt update
wsl -d $distro sudo apt dist-upgrade -y
Write-Output "Installing dependencies and setting up environment..."
wsl -d $distro sudo apt install p7zip-full secure-delete whiptail curl dos2unix pv zenity '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev -y
Write-Output "Downloading latest release of Open Android Backup..."

$RANDOM = Get-Random -Minimum 1000 -Maximum 1000000
$OAB_DIRECTORY="open_android_backup_conveniencescript_$($RANDOM)"
$LATEST_RELEASE=(Invoke-WebRequest -Uri "https://api.github.com/repos/mrrfv/open-android-backup/releases/latest" -UseBasicParsing | ConvertFrom-Json).tag_name

New-Item -ItemType Directory -Path $OAB_DIRECTORY -Force | Out-Null
Set-Location $OAB_DIRECTORY
Invoke-WebRequest -Uri "https://github.com/mrrfv/open-android-backup/releases/download/$LATEST_RELEASE/Open_Android_Backup_${LATEST_RELEASE}_Bundle.zip" -OutFile "Open_Android_Backup_${LATEST_RELEASE}_Bundle.zip"
Expand-Archive "Open_Android_Backup_${LATEST_RELEASE}_Bundle.zip" -DestinationPath .
Write-Output "Converting files - this may take several minutes..."
wsl -d $distro bash -c "sudo find ./ -name '*.sh' -type f -print0 | sudo xargs -0 dos2unix --"
Write-Output "Running Open Android Backup..."
wsl -d $distro ./windows-dependencies/env-startup.sh
Write-Output "Cleaning up..."
wsl --shutdown
try {
Stop-Process -Name adb.exe -Force | Out-Null
Stop-Process -Name adb -Force | Out-Null
} catch {
Write-Output "adb not running."
}
Set-Location ..
Remove-Item $OAB_DIRECTORY -Recurse -Force
Write-Output "Done!"
Write-Output "Exiting."
pause
exit 1

0 comments on commit 6d9bdf7

Please sign in to comment.