[Droid Incredible Android Development] m0d:
So, this is the only script I found to backup and restore app data.

Needs some changes for newer android OS

Needs a check, as out of the box toybox is used, not busybox

Mount point needs something:

As

# busybox grep /system /proc/mounts | busybox awk '{print $1}'
/dev/block/bootdevice/by-name/system
/dev/block/bootdevice/by-name/system

It is doubled.

Removing $DEVICE seems to work. I removed $DEVICE from all mount commands:

From:

$MOUNT -o remount,rw $DEVICE /system

To:

$MOUNT -o remount,rw /system

backup needs a fix for app list

$EGREP "^< seems to cause issues. I removed ^ and it worked, meaning applist success.

I was able to backup data, but the apks were missing. Maybe because it used to be app.apk now it is base.apk?

restore does not work at the moment

As applist returns empty. Checked /dev/applist.txt and it was empty for some reason.

Also, fix_permissions file not in some devices, /dev/fix_permissions not found.

Some issues:

{system("busybox cat /data/system/packages.list | busybox grep $2")}

causes errors

Some errors when creating applist, but apps are displayed afterwards. So, might be same issue as above

Creating app list to /dev/applist.txt...
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
sh: /data/system/packages.list: can't execute: Permission denied
Done!
[1] app a...
[2] app a...
[3] app c...
...
[35] app o...
[36] app o...
[37] app o...
[38] app o...
[39] app o...
[40] app x...

Last thing is that the commands used to generate applist

$ECHO "Creating app list to /dev/applist.txt..."

$CAT /data/system/packages.xml | $EGREP "<package.*serId" | $GREP -v framework-res.apk | \
$GREP -v com.htc.resources.apk | $SED 's/<package name=\"//' | $SED 's/\" codePath="/ /' | \
$SED 's/\"//g' | $SED -e 's/\/data\/app-private\//private /' | $SED 's/\/data\/app\//app /' | \
$SED 's/\/system\/app\//system /' | $SED 's/\/mnt\/asec\//sd /' | \
$AWK '{if($2 !~ /system/) printf "%10s %s %s",$2,$1,$3"\n"}' | sort | \
$AWK '(++count) {printf "%5s %7s %s %s\n","["count"]",$1,$2,$3} \
{system("$CAT /data/system/packages.list | $GREP $2")}' | $SED 's/\/data\/data\///' | \
$AWK '{printf "%5s %7s %s %s %s\n",$1,$2,$3,$4,$8}' > $applist

causes some errors, even though apps are displayed at the end:

BusyBox v1.22.1 bionic (2017-04-22 22:10 +0300) multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

-H	Add 'filename:' prefix
-h	Do not add 'filename:' prefix
-n	Add 'line_no:' prefix
-l	Show only names of files that match
-L	Show only names of files that don't match
-c	Show only count of matching lines
-o	Show only the matching part of line
-q	Quiet. Return 0 if PATTERN is found, 1 otherwise
-v	Select non-matching lines
-s	Suppress open and read errors
-r	Recurse
-i	Ignore case
-w	Match whole words only
-x	Match whole lines only
-F	PATTERN is a literal (not regexp)
-E	PATTERN is an extended regexp
-m N	Match up to N times per file
-A N	Print N lines of trailing context
-B N	Print N lines of leading context
-C N	Same as '-A N -B N'
-e PTRN	Pattern to match
-f FILE	Read pattern from file

cat: write error: Broken pipe
BusyBox v1.22.1 bionic (2017-04-22 22:10 +0300) multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

-H	Add 'filename:' prefix
-h	Do not add 'filename:' prefix
-n	Add 'line_no:' prefix
-l	Show only names of files that match
-L	Show only names of files that don't match
-c	Show only count of matching lines
-o	Show only the matching part of line
-q	Quiet. Return 0 if PATTERN is found, 1 otherwise
-v	Select non-matching lines
-s	Suppress open and read errors
-r	Recurse
-i	Ignore case
-w	Match whole words only
-x	Match whole lines only
-F	PATTERN is a literal (not regexp)
-E	PATTERN is an extended regexp
-m N	Match up to N times per file
-A N	Print N lines of trailing context
-B N	Print N lines of leading context
-C N	Same as '-A N -B N'
-e PTRN	Pattern to match
-f FILE	Read pattern from file