[Xposed General] MariferC:
Something as this?:

#!/sbin/sh
#
#
# /system/addon.d/81-Xposed.sh
# During a LineageOS 14.1 upgrade, this script backs up Xposed framework files.
# /system is formatted and reinstalled, then the files are restored.
# Based on Xposed "flash-script.sh" script and https://xdaforums.com/xposed/addon-d-script-xposed-to-survive-cm13-t3268520

export C=/sdcard/xposed_backupdir-1234

backup_file() {
if [ -e "$1" ]; then
if [ ! -L "$1" ]; then
local F="${1##*/}"
local D="${1%/*}"

mkdir -p "$C/$D"
cp -dp "$1" "$C/$D/$F"
else
ui_print "Skipping symbolic link $1"
fi
else
ui_print "NE: $1"
fi
}

restore_file() {
local FILE="${1##*/}"
local DIR="${1%/*}"

if [ -e "$C/$DIR/$FILE" ]; then
if [ "$FILE" == "xposed.prop" ] || [ "$FILE" == "XposedBridge.jar" ]; then
restore_nobackup "/$DIR/$FILE" 0 0 0644
elif [ "$FILE" == "app_process64_xposed" ] || [ "$FILE" == "app_process32_xposed" ]; then
restore_and_link "/$DIR/${FILE%_xposed}" 0 2000 0755 u:object_r:zygote_exec:s0
elif [ "$FILE" == "dex2oat" ] || [ "$FILE" == "patchoat" ]; then
restore_overwrite "/$DIR/$FILE" 0 2000 0755 u:object_r:dex2oat_exec:s0
elif [ "$FILE" == "oatdump" ]; then
restore_overwrite "/$DIR/$FILE" 0 2000 0755
else
restore_overwrite "/$DIR/$FILE" 0 0 0644
fi
else
ui_print "NE: $C/$DIR/$FILE"
fi
}

cp_perm() {
cp -f "$1" "$2" || exit 1
set_perm "$2" $3 $4 $5 $6
}

set_perm() {
chown $2:$3 "$1" || exit 1
chmod $4 "$1" || exit 1
if [ "$5" ]; then
chcon $5 "$1" 2>/dev/null
else
chcon 'u:object_r:system_file:s0' "$1" 2>/dev/null
fi
}

restore_nobackup() {
cp_perm "$C/$1" "$1" $2 $3 $4 $5
}

restore_and_link() {
TARGET="${1}"
XPOSED="${1}_xposed"
BACKUP="${1}_original"
if [ ! -f "$C/$XPOSED" ]; then
return
fi
cp_perm "$C/$XPOSED" "$XPOSED" $2 $3 $4 $5
if [ ! -f "$BACKUP" ]; then
mv "$TARGET" "$BACKUP" || exit 1
ln -s "$XPOSED" "$TARGET" || exit 1
chcon -h 'u:object_r:system_file:s0' "$TARGET" 2>/dev/null
fi
}

restore_overwrite() {
TARGET=$1
BACKUP="${1}.orig"
NO_ORIG="${1}.no_orig"
if [ ! -f "$TARGET" ]; then
touch "$NO_ORIG" || exit 1
set_perm "$NO_ORIG" 0 0 600
elif [ -f "$BACKUP" ]; then
rm -f "$TARGET"
gzip "$BACKUP" || exit 1
set_perm "${BACKUP}.gz" 0 0 600
elif [ ! -f "${BACKUP}.gz" ] && [ ! -f "$NO_ORIG" ]; then
mv "$TARGET" "$BACKUP" || exit 1
gzip "$BACKUP" || exit 1
set_perm "${BACKUP}.gz" 0 0 600
fi
cp_perm "$C/$TARGET" "$TARGET" $2 $3 $4 $5
}

ui_print() {
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}

list_files() {
cat <<EOF
/system/xposed.prop
/system/framework/XposedBridge.jar
# For 32bits
/system/bin/app_process32_xposed
/system/bin/dex2oat
/system/bin/oatdump
/system/bin/patchoat
/system/lib/libart.so
/system/lib/libart-compiler.so
/system/lib/libart-disassembler.so
/system/lib/libsigchain.so
/system/lib/libxposed_art.so
# For 64bits
/system/bin/app_process64_xposed 64bit
/system/lib64/libart.so 64bit
/system/lib64/libart-compiler.so 64bit
/system/lib64/libart-disassembler.so 64bit
/system/lib64/libsigchain.so 64bit
/system/lib64/libxposed_art.so 64bit
EOF
}

OSA="32bit"
OUTFD=`ps | grep -v grep | grep -oE "update(.*)" | cut -d" " -f3`
API=$(sed -n "s/^ro.build.version.sdk=//p" /system/build.prop | head -n 1)
ABILONG=$(sed -n "s/^ro.product.cpu.abi=//p" /system/build.prop | head -n 1)

if [ "$API" -ge "21" ]; then
if [ "$ABILONG" = "arm64-v8a" ] || [ "$ABILONG" = "x86_64" ]; then OSA="64bit"; fi;
fi

case "$1" in
backup)
ui_print "Starting to backup Xposed"
list_files | while read FILE ARCH; do
echo $FILE | grep -q '^#'
if [ $? -ne 0 ]; then
if [ $ARCH ] && [ "$ARCH" != "$OSA" ]; then continue; fi;
backup_file "$FILE"
fi
done
ui_print "Ending to backup Xposed"
;;
restore)
ui_print "Starting to restore Xposed"
list_files | while read FILE ARCH; do
echo $FILE | grep -q '^#'
if [ $? -ne 0 ]; then
if [ $ARCH ] && [ "$ARCH" != "$OSA" ]; then continue; fi;
restore_file "$FILE"
fi
done

if [ "$API" -ge "22" ]; then
find /system /vendor -type f -name '*.odex.gz' 2>/dev/null | while read f; do mv "$f" "$f.xposed"; done
fi

rm -rf "${C:?}/"
ui_print "Ending to restore Xposed"
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac