summaryrefslogtreecommitdiff
path: root/kanotix/enable_persistent_live.bash
diff options
context:
space:
mode:
Diffstat (limited to 'kanotix/enable_persistent_live.bash')
-rw-r--r--kanotix/enable_persistent_live.bash26
1 files changed, 24 insertions, 2 deletions
diff --git a/kanotix/enable_persistent_live.bash b/kanotix/enable_persistent_live.bash
index 807730a..c1097c7 100644
--- a/kanotix/enable_persistent_live.bash
+++ b/kanotix/enable_persistent_live.bash
@@ -9,7 +9,7 @@ partition=3
filesystem=ext4
. /etc/default/distro
-isodev="$(awk '{if($2=="/live/image"||$2=="/lib/live/mount/medium"){print $1;}}' /proc/mounts)"
+isodev="$(awk '{if($2=="/live/image"||$2=="/lib/live/mount/medium"||$2=="/run/live/medium"){print $1;}}' /proc/mounts)"
case $isodev in
/dev/sd*) ;;
*) isodev= ;;
@@ -25,6 +25,15 @@ exit 1
;;
esac
+if [ -d "/run/live/persistence" ]; then
+if [ -x "$KDIALOG" ]; then
+ $KDIALOG --error "Persistent mode seems to be enabled already!" --title "Persistent Live-USB-Stick"
+elif [ -x "$ZENITY" ]; then
+ $ZENITY --error --text "Persistent mode seems to be enabled already!" --title "Persistent Live-USB-Stick"
+fi
+exit 1
+fi
+
if [ "$FLL_DISTRO_MODE" != "live" -o -z "$isodev" ]; then
if [ -x "$KDIALOG" ]; then
$KDIALOG --error "This script can only be used from a Live USB-Stick!" --title "Persistent Live-USB-Stick"
@@ -98,6 +107,18 @@ if [ ! -e "$isodisk"$partition ]; then
mkfs.$filesystem -L "persistence" "$isodisk"$partition
fi
+if [ -d /run/live/medium ]; then
+ mkdir -p /run/live/persistence
+ mount "$isodisk"$partition /run/live/persistence
+ set -- $(cat /proc/cmdline)
+ shift
+ echo "set persistence_cmdline='$@ persistence'" > /run/live/persistence/grub.cmdline
+ echo "/ union" > /run/live/persistence/persistence.conf
+ umount /run/live/persistence
+ rmdir /run/live/persistence
+
+else
+
if [ -d /lib/live/mount ]; then
mkdir -p /lib/live/mount/persistence
mount "$isodisk"$partition /lib/live/mount/persistence
@@ -117,7 +138,8 @@ elif [ -d /live ]; then
umount /live/persistence
rmdir /live/persistence
fi
-
+fi
#killall -9 kdialog
kill $(ps ax | grep kdialog | grep Live-USB | cut -c2-5)
+killall -9 kdialog_progress_helper
exit 0