From bbf2e7f069e5bb8d229040aaa6c66d8e6b6c50c6 Mon Sep 17 00:00:00 2001 From: kszaq Date: Mon, 14 Nov 2016 06:04:00 +0100 Subject: [PATCH] projects/S*05: add an option to copy user data when installing to internal memory --- .../filesystem/usr/sbin/installtointernal | 22 +++++++++++++++--- .../filesystem/usr/sbin/installtointernal | 23 ++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/projects/S805/filesystem/usr/sbin/installtointernal b/projects/S805/filesystem/usr/sbin/installtointernal index f394f9b6e29..58dae2e3e7d 100755 --- a/projects/S805/filesystem/usr/sbin/installtointernal +++ b/projects/S805/filesystem/usr/sbin/installtointernal @@ -72,9 +72,25 @@ install_to_nand() { echo "done." fi - echo "All done! Rebooting in 10s..." - sleep 10 - rebootfromnand + read -p "Do you want to copy your user data to internal data partition? [Y/n] " choice + case "$choice" in + [nN]*) + ;; + *) + echo -n "Stopping Kodi..." + systemctl stop kodi + echo "done." + echo "Copying user data..." + mkdir -p /tmp/data + mount -o rw /dev/data /tmp/data + cp -av /storage/. /tmp/data/ + echo -n "Restarting Kodi..." + systemctl start kodi + echo "done." + ;; + esac + + echo "All done! You can now continue using your LE system or type \"rebootfromnand\" to reboot from internal memory." else echo "No LE image found on /flash! Exiting..." diff --git a/projects/S905/filesystem/usr/sbin/installtointernal b/projects/S905/filesystem/usr/sbin/installtointernal index 88ff6fd631b..9db2d21cba0 100755 --- a/projects/S905/filesystem/usr/sbin/installtointernal +++ b/projects/S905/filesystem/usr/sbin/installtointernal @@ -91,9 +91,26 @@ install_to_nand() { echo "done." fi - echo "All done! Rebooting in 10s..." - sleep 10 - rebootfromnand + read -p "Do you want to copy your user data to internal data partition? [Y/n] " choice + case "$choice" in + [nN]*) + ;; + *) + echo -n "Stopping Kodi..." + systemctl stop kodi + echo "done." + echo "Copying user data..." + mkdir -p /tmp/data + mount -o rw /dev/data /tmp/data + cp -av /storage/. /tmp/data/ + echo -n "Restarting Kodi..." + systemctl start kodi + echo "done." + ;; + esac + + echo "All done! You can now continue using your LE system or type \"rebootfromnand\" to reboot from internal memory." + echo "WARNING: If your internal memory layout is different from standard Amlogic, you have to reboot and perform this operation again!" else echo "No LE image found on /flash! Exiting..."