Xu Fasheng a3049abe50 | ||
---|---|---|
completion | ||
example | ||
include | ||
test | ||
.gitignore | ||
deployidroid | ||
gencode.sh | ||
LICENSE | ||
Makefile | ||
README_cn.org | ||
README.org | ||
usage.org |
- Features
- Requirement
- Quick start
- Usage
- Configuration file of deployidroid
- Backup directory structure
- Run tests
- Full usage
- Donation
- License
English | 简体中文
Description: Deploy and backup Android applications from F-Droid repository in computer side.
Keywords: shell, android, fdroid, package-manager, deploy, backup, root, titanium-backup
Features
- Support download and install Android application from F-Droid repository
- Support upgrade applications to latest version in device if possible
- Support shell completion
- Support multiple users in Android
- Support backup and restore applications
- Support backup special data, such as accounts, WiFi access-points
- Support increment backup, the data files that timestamp not changed will be ignored
- Support create profile files for different devices
- Provide methods to encrypt user data
- Try to fix compatibility issue when restore applications to different Android version
- Works fine for Android
4.0+
(API level 14+). And the older versions should works, too, but need more testing work
Requirement
Command dependents in computer side:
- bash >=4.0
- curl
- xmlstarlet
- sha1sum
- sha256sum
- tar
- gzip
- adb
- openssl (optional, only need for
--password
argument)
And in Android side:
- sha1sum
- find
- tar
- gzip
- gunzip (if missing just install busybox)
- Enable debug mode
- Root permission in adb shell, either
adb root
works orsu
command exists will be fine - Enough free space in device temporary directory (default is
/data/local/tmp
, and could special it with argument--device-tmpdir
)
Quick start
# download deployidroid
wget https://gitea.com/fasheng/deployidroid/raw/branch/master/deployidroid
chmod +x deployidroid
# enable command completion for bash
source <(./deployidroid complete --bash)
# fetch F-Droid repository index.xml file
./deployidroid update
# install applications
./deployidroid install org.fdroid.fdroid com.nextcloud.client
./deployidroid install org.fdroid.fdroid=1007051
# upgrade applications
./deployidroid upgrade
# backup applications
./deployidroid backup org.fdroid.fdroid com.nextcloud.client
# restore applications
./deployidroid restore org.fdroid.fdroid com.nextcloud.client
# deploy nextcloud from profile
./deployidroid deploy --profile example/deploy-nextcloud.sh
Usage
-
Enable command completion
-
for bash
source <(deployidroid complete --bash)
-
for fish
source <(deployidroid complete --fish | psub)
-
-
Update F-Droid repository
index.xml
file before operationsdeployidroid update
-
List applications in repositories
-
List all applications, could use
--cat
,--desc
,--ver
to show category, description and available versionsdeployidroid list deployidroid list --cat --desc --ver
-
List applications with matched keyword, the keyword support awk regexp syntax. And if use
--cat
,--desc
,--ver
, will search text in the related fieldsdeployidroid list fdroid deployidroid list --cat --desc --ver fdroid
-
List applications in category "System"
deployidroid list --cat System
-
List applications with special application ID
deployidroid list --appid org.fdroid.fdroid org.fdroid.fdroid.privileged
-
List applications in special repository
deployidroid list --repo fdroid
-
Show application suggest version, the result will be different if different adb device connected
deployidroid list --sug --appid org.fdroid.fdroid com.jereksel.libresubstratum
-
-
Download and install application to device
-
Install the suggest latest stable version
deployidroid install org.fdroid.fdroid
-
Install the suggest version, include unstable version
deployidroid install --allow-unstable org.fdroid.fdroid
-
Install special version
deployidroid install org.fdroid.fdroid=1007051
-
Install to special users
deployidroid adb list-users deployidroid install --user 0 --user 10 org.fdroid.fdroid
-
-
Uninstall application from device
deployidroid uninstall --user cur org.fdroid.fdroid
-
Upgrade applications
-
List all upgrade-able applications
deployidroid upgrade --list
-
Upgrade all applications if possible
deployidroid upgrade
-
-
Deploy and cleanup applications in profile
-
deploy microg
deployidroid deploy --profile example/deploy-microg.sh deployidroid cleanup --profile example/deploy-microg.sh
-
deploy nextcloud
deployidroid deploy --profile example/deploy-nextcloud.sh deployidroid cleanup --profile example/deploy-nextcloud.sh
-
deploy without profile
deployidroid deploy 'org.fdroid.fdroid' 'user_10:com.nextcloud.client:allow_unstable=1' deployidroid cleanup 'org.fdroid.fdroid' 'user_10:com.nextcloud.client:allow_unstable=1'
-
backup and cleanup useless services in Samsung devices
deployidroid backup --profile ./example/cleanup-samsung.sh deployidroid cleanup --profile ./example/cleanup-samsung.sh
-
-
Backup & Restore applications
-
Ensure root permission for adb shell works firstly, there are two methods:
-
su
coommand worksadb shell su -c "id -u -r"
-
adb root
worksadb root adb shell "id -u -r"
-
-
Backup apps and restore later
deployidroid backup user_0:com.pkg1.name user_0:com.pkg2.name deployidroid restore --user cur user_0:com.pkg1.name user_0:com.pkg2.name
-
Backup or restore with the
appinfo.sh
filedeployidroid backup --options 'type=app+data' ./data/default/user_0/com.pkg.name/appinfo.sh deployidroid restore --options 'type=app+data' ./data/default/user_0/com.pkg.name/appinfo.sh
-
Clone apps to another device or user, will create user automatically, but if failed please ensure user exists at first
deployidroid backup user_cur:com.pkg.name deployidroid restore --user 10 --user 11 ./data/default/user_0/com.pkg.name/appinfo.sh deployidroid restore --user 10 --user 11 user_0:com.pkg.name
-
Backup special user data, such as accounts and saved WiFi access points
deployidroid backup @user.accounts @wifi
-
Create backup profile, so flashing roms work will be easy
deployidroid new --3rd-app --3rd-data --freq-data --spec-data --profile test.sh deployidroid backup --profile test.sh deployidroid restore --profile test.sh
-
Encrypt the user data
-
Use
--password
argument set the archive password, if value is "-", will read password from inputdeployidroid backup --password - com.pkg.name deployidroid restore --password - com.pkg.name
-
Use encfs or similar tools encrypt the full data directory
encfs .data data
-
-
-
Special Android device with
ANDROID_SERIAL
environment or--serial
argument, useful when multiple devices connectedenv ANDROID_SERIAL=xxxx deployidroid <commands> deployidroid --serial xxxx <commands>
Configuration file of deployidroid
Just customize F-Droid repository sources and other variables in
~/.config/deployidroid/config.sh
, here is an example:
fdroid_opt_cache_dir="${HOME}/.cache/deployidroid"
fdroid_opt_download_cmd="wget -c '%s'"
adb_opt_device_tmpdir='/data/local/tmp'
repos=(
["fdroid"]="https://f-droid.org/repo"
["izzy"]="https://apt.izzysoft.de/fdroid/repo"
["retroarch"]="https://fdroid.libretro.com/repo"
["microg"]="https://microg.org/fdroid/repo"
["nethunter"]="https://store.nethunter.com/repo"
)
Backup directory structure
├── profile.sh ├── app │ ├── com.pkg.name-1.0-10.apk └── data └── profile-name └── user_0 │ ├── com.pkg.name │ │ ├── com.pkg.name.tar.gz │ │ └── appinfo.sh │ └── @user.wallpaper │ ├── appinfo.sh │ └── @user.wallpaper.tar.gz └── user_system ├── @bluetooth │ ├── @bluetooth.tar.gz │ └── appinfo.sh └── @wifi ├── appinfo.sh └── @wifi.tar.gz
backup/restore profile.sh
example
version='0.9.5'
# profile name
name='test'
appdir='./app'
datadir='./data/test'
android_version='6.0.1'
android_api_level=23
users=(system 0)
system_apps=(
# spec system data
'@datausage' # network data usage
'@bluetooth' # bluetooth pair data
'@wifi' # wifi connection data
# system apps
'com.google.android.gms:type=app' # microG Services Core
)
user_apps=(
# spec user data
'@user.accounts' # accounts data
'@user.wallpaper' # wallpaper
# system apps data
'com.google.android.gms:type=data' # microG Services Core
# 3rd apps
'org.fdroid.fdroid:type=app+data' # F-Droid
)
deploy/cleanup profile.sh
example
version='0.9.5'
# profile name
name='test'
fdroid_repos=(
["fdroid"]="https://f-droid.org/repo"
["microg"]="https://microg.org/fdroid/repo"
)
fdroid_opt_allow_unstable=
users=(system 0)
system_apps=(
'com.google.android.gms:type=app;repo=microg;version_code=19420020;install_path=/system/priv-app' # microG Services Core
)
user_apps=(
'org.fdroid.fdroid:type=app+data;allow_unstable=1' # F-Droid
)
appinfo.sh
example
id='org.fdroid.fdroid'
version_name='1.6'
version_code='1006050'
android_api_level='23' # android 6.0.1
is_system=''
is_encrypted=''
install_path='/vendor/app'
data_timestamp='1552435308'
Run tests
Install bats and run:
make test
License
GNU General Public License, Version 3.0+