~jamesodhunt/ubuntu/precise/friendly-recovery/system-symmary-add-lvm+apt

« back to all changes in this revision

Viewing changes to lib/recovery-mode/recovery-menu

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2011-09-07 20:18:53 UTC
  • Revision ID: package-import@ubuntu.com-20110907201853-38vccqj3bvf2rphl
Tags: 0.2.13
* Move everything to /lib/recovery-mode/ (LP: #234409)
* Don't use the fullpath to whiptail
* Add new init script starting on recovery-mode (LP: #459376)
* If whiptail can't be found, just start sulogin
* Add a script to start mountall (remount everything read/write)
  (LP: #575469, LP: #651782)
* Export READONLY to all scripts so they can test on the read/write state
* Disable most scripts when the system is read only
* Change file system check to happen when remount is called
* Wait after all scripts returning output so the user can read it
* Add postinst script to move any existing script to /lib/recovery-mode
  and make /usr/share/recovery-mode a symlink
* Mark as breaking on older grub2, upstart and initramfs-tools
* Small packaging refresh:
  - Bump standard to 3.9.2, no change needed
  - Drop simple patchsys (no patches)
  - No need to depend on bash (essential package)
  - Add ${misc:Depends} to dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# include gettext stuff
 
4
. /lib/recovery-mode/l10n.sh
 
5
 
 
6
# main
 
7
menu_text=$(eval_gettext "Recovery Menu (limited read-only menu)")
 
8
READONLY=true
 
9
export READONLY
 
10
 
 
11
while true; do
 
12
  unset items
 
13
 
 
14
  items[c++]="resume"
 
15
  items[c++]=$(eval_gettext "   Resume normal boot")
 
16
 
 
17
  for i in /lib/recovery-mode/options/*; do
 
18
    if [ -x "$i" ]; then
 
19
      name="`"$i" test`"
 
20
      if [ $? -eq 0 ]; then
 
21
        items[c++]="`basename "$i"`"
 
22
        items[c++]="   $name"
 
23
      fi
 
24
    fi
 
25
  done
 
26
 
 
27
  if [ ! -x "$(which whiptail)" ]; then
 
28
    echo $(eval_gettext "Couldn't find whiptail, starting root shell instead of recovery menu.")
 
29
    sulogin
 
30
    clear
 
31
    exit 0
 
32
  fi
 
33
  choice="$(whiptail --menu "$menu_text" 15 70 6 \
 
34
                             "${items[@]}" \
 
35
                             3>&1 1>&2 2>&3 3>&-)"
 
36
 
 
37
  if [ $? -ne 0 ]; then
 
38
    choice="resume"
 
39
  fi
 
40
 
 
41
  if [ "$choice" = "resume" ]; then
 
42
    clear
 
43
    exit
 
44
  fi
 
45
 
 
46
  "/lib/recovery-mode/options/$choice"
 
47
  retval=$?
 
48
 
 
49
  if [ "$choice" = "remount" ] || [ "$choice" = "fsck" ]; then
 
50
    menu_text=$(eval_gettext "Recovery Menu")
 
51
    READONLY=false
 
52
  fi
 
53
 
 
54
  if [ "$retval" -eq 42 ]; then
 
55
    clear
 
56
    exit 0
 
57
  fi
 
58
done