summaryrefslogtreecommitdiff
path: root/kanotix/9000-enable-persistent
blob: c8f0b31b7bcbba62f3dc39410f7e8c742c178e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh

# "enable persistent" desktop-icon

Persistent ()
{
if [ -e /var/lib/live/config/enable-persistent ]
then
	return
fi
echo -n " enable-persistent"
Configure_Persistent
}

Configure_Persistent ()
{
if ! [ -x /usr/local/bin/enable_persistent_live.bash ]
then
	touch /var/lib/live/config/enable-persistent
	return
fi

HAVE_PERS_CMDLINE="$(grep -F persistence /proc/cmdline)"
if [ -n "$HAVE_PERS_CMDLINE" ]; then
    HAVE_PERS_CMDLINE="persistence"
fi

ISO_DEVICE="$(awk '{if($2=="/live/image"||$2=="/lib/live/mount/medium"||$2=="/run/live/medium"){print $1;}}' /proc/mounts)"

case "$ISO_DEVICE" in
/dev/sd*) 
	case "$HAVE_PERS_CMDLINE" in
	persistence)
		rm -f /home/${LIVE_USERNAME}/Desktop/enable_persistent.desktop
		;;
	*)
		sudo -u "${LIVE_USERNAME}" sh -c "mkdir -p /home/${LIVE_USERNAME}/Desktop; cat > /home/${LIVE_USERNAME}/Desktop/enable_persistent.desktop" <<"EOF"
[Desktop Entry]
Comment[de]=Diesen Live-USB-Stick persistent machen, d.h. alle Änderungen werden auf dem Stick gespeichert.
Comment=Make this Live-USB-Stick persistent, i.e. all changes will be saved to the stick.
Exec=/usr/local/bin/enable_persistent_live.bash
Icon=acritoxinstaller
MimeType=
Name[de]=»persistent« aktivieren
Name=enable »persistent«
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
EOF
		chmod +x /home/${LIVE_USERNAME}/Desktop/enable_persistent.desktop
		;;
	esac
	;;
*)
	rm -f /home/${LIVE_USERNAME}/Desktop/enable_persistent.desktop
	;;
esac

touch /var/lib/live/config/enable-persistent
}

Persistent