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

« back to all changes in this revision

Viewing changes to lib/recovery-mode/options/apt-snapshots

  • 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
set -e
 
4
 
 
5
. /lib/recovery-mode/l10n.sh
 
6
 
 
7
if [ "$READONLY" = "true" ]; then
 
8
    exit 1
 
9
fi
 
10
 
 
11
# check if its there
 
12
if [ ! -x /usr/bin/apt-btrfs-snapshot ]; then
 
13
    exit 1
 
14
fi
 
15
 
 
16
# check if its usable, if list returns a non-zero exit code, 
 
17
# we probably run on a system with no snapshot support
 
18
if ! /usr/bin/apt-btrfs-snapshot list > /dev/null  2>&1; then
 
19
    exit 1
 
20
fi
 
21
 
 
22
# if we make it to this point, show some help
 
23
if [ "$1" = "test" ]; then
 
24
    echo $(eval_gettext "Revert to old snapshot and reboot")
 
25
    exit 0
 
26
fi
 
27
 
 
28
# get snapshots and show them in whiptail
 
29
snapshots=$(apt-btrfs-snapshot list | sed 1d)
 
30
tag_item=""
 
31
for item in $snapshots; do
 
32
    tag_item="$item snapshot $tag_item"
 
33
done
 
34
 
 
35
choice="$(whiptail --menu "$(eval_gettext "Snapshot")" 15 70 6 $tag_item \
 
36
         3>&1 1>&2 2>&3 3>&-)"
 
37
# user selected cancel
 
38
if [ -z "$choice" ]; then
 
39
    exit 0
 
40
fi
 
41
 
 
42
# set new snapshot and reboot
 
43
if apt-btrfs-snapshot set-default "$choice"; then
 
44
    reboot
 
45
fi
 
46