summaryrefslogtreecommitdiffstats
path: root/tools/umount-live
blob: 098c82e5c05dbab303bea4fd5e6450b16f7a75c5 (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
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: umount-live
# Default-Stop: 0 6
# Should-Stop: $remote_fs
# Short-Description: Umounts live-system-specific mountpoints on
#halt/reboot
# Description: This service umounts live-system-specific mountpoints
#on halt/reboot.
### END INIT INFO

mypath=$_

case "$1" in
   *start)
        ;;
   *stop)
        exit
        ;;
   *)
        gprintf "Usage: %s\n" "$(basename $0) {start}"
        exit 1
        ;;
esac

roottype=`awk '$2 == "/" { print $3 }' /etc/fstab`

if [ "$roottype" != unionfs ]; then
    # disable self during first halt when installed
    chkconfig --del $(basename $0)
    #rm -f $mypath
    exit
fi

maybe_umount() {
    eval d=\$$#
    [ -e $d ] && umount $@
}

maybe_umount -l /live/distrib
maybe_umount -l /live/memory
maybe_umount -l /live/system
maybe_umount -l /live/media

maybe_umount /var/lib/rpm
maybe_umount /tmp/rpm/real
maybe_umount /tmp/rpm