summaryrefslogtreecommitdiffstats
path: root/examples/lvm_menu/lvm_menu.sh
blob: cad4db01e8122798a89274b0c7d4f6b78007b27f (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
#!/bin/bash

MENU+="\
'Create' 'Delete' 'Extend' 'Shrink'
'VGC VG' 'VGD VG' 'VGE VG' 'VGS VG'
'LVC LV' 'LVD LV' 'LVE LV' 'LVS LV'
'PVC PV' 'PVD PV'
#
'L List'
#
'Quit Exit menu'"

trap "exit 1" INT

while true
do
   clear
   echo "Executing ${0##*/}"
   echo

   MESSAGE="LVM management"
   read REP <<< $(echo "$MENU" | ./menu.sh -i "$MESSAGE" "-Rd1")

   case $REP in
     ABORT) exit 1         ;;
     QUIT)  exit 0         ;;

     L)     echo List      ;;

     VGC)   echo VG create ;;
     VGD)   echo VG delete ;;
     VGE)   echo VG expand ;;
     VGS)   echo VG shrink ;;

     LVC)   echo LV create ;;
     LVD)   echo LV delete ;;
     LVE)   echo LV expand ;;
     LVS)   echo LV list   ;;

     PVC)   echo PV create ;;
     PVD)   echo PV delete ;;
   esac

   echo
   echo -n "Press <Enter> to continue"
   read
done

exit 0