~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/bootcdflop

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
#
3
 
### BEGIN INIT INFO
4
 
# Provides:          bootcdflop
5
 
# Required-Start:    mountall-bootclean $local_fs
6
 
# Required-Stop:
7
 
# X-Start-Before:    networking
8
 
# Default-Start:     S
9
 
# Default-Stop:      
10
 
# Short-Description: bootcdflop reads changes from floppy if running from bootcd
11
 
# Description:       When running from bootcd this script tries to access 
12
 
#                    the floppy to read changes last time saved with 
13
 
#                    bootcdflopcp from a running bootcd.
14
 
### END INIT INFO
15
 
 
16
 
MNT=/mnt
17
 
FLOPPY=/dev/fd0
18
 
BOOT_ONLY_WITH_FLOPPY="no"
19
 
FSTYPES="ext3,ext2,reiserfs,iso9660,vfat,auto"
20
 
 
21
 
startscript()
22
 
{
23
 
  # bootcdwrite modifies this script. FLOPPY could be unset.
24
 
  if [ ! "$FLOPPY" ]; then
25
 
    echo "No Floppy device specified !!"
26
 
    exit 0
27
 
  fi
28
 
  
29
 
  echo "Reading floppy"
30
 
  fsck -a -t $FSTYPES $FLOPPY
31
 
  mount -v -o ro -n -t $FSTYPES $FLOPPY $MNT
32
 
  RET=$?
33
 
    
34
 
  if [ "$BOOT_ONLY_WITH_FLOPPY" = "yes" -a $RET -ne 0 ]; then
35
 
    echo "The floppy could not be mounted."
36
 
    echo "Manual interaction required."
37
 
    # Start a single user shell on the console
38
 
    /sbin/sulogin $CONSOLE
39
 
  fi
40
 
  
41
 
  [ -f $MNT/change.tgz ] && (cd /; tar xzf $MNT/change.tgz)
42
 
  
43
 
  [ -f $MNT/remove ] && for i in `cat $MNT/remove`
44
 
  do
45
 
    rm -f /$i
46
 
  done
47
 
  
48
 
  [ -x $MNT/execute ] && $MNT/execute
49
 
  
50
 
  umount $MNT
51
 
  
52
 
  # If something has been changed in /etc/inittab
53
 
  init q
54
 
}
55
 
 
56
 
case "$1" in
57
 
  start)
58
 
        # Only run this script if we have booted from bootcd
59
 
        if [ "$(grep "\<bootcd=" /proc/cmdline)" ]; then
60
 
          startscript
61
 
        fi
62
 
        ;;
63
 
  restart) 
64
 
        ;;
65
 
  status)
66
 
        ;;
67
 
  force-reload)
68
 
        ;;
69
 
  stop)
70
 
        ;;
71
 
  restart)
72
 
        ;;
73
 
  force-reload)
74
 
        ;;
75
 
  *)
76
 
        echo "Usage: /etc/init.d/bootcdram start" >&2
77
 
        exit 1
78
 
        ;;
79
 
esac
80
 
 
81
 
exit 0