summaryrefslogtreecommitdiffstats
path: root/firstaidkit-qs
blob: a43b8290437f189bf9c4197ef42da0b4a9c23848 (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
#!/bin/sh

function pause()
{
  echo "Press enter to continue"
  read a
}

if [ "$DISPLAY" == "" ]; then
  DIALOG="whiptail --fb"
else
  DIALOG="zenity"
fi

OPTION=""
TMPFILE="/tmp/$(basename $0)-$$.item"
TITLE="First Aid Kit quickstart menu"

WIDTH="45"
HEIGHT="18"
MENUHEIGHT="10"
TIMEOUT=60

while [ "x$OPTION" == "x" ]; do
  $DIALOG --menu "$TITLE" "$HEIGHT" "$WIDTH" "$MENUHEIGHT" shell "Start shell" fakd "Run diagnostic" reboot "Reboot"  2>$TMPFILE
  if [ "$?" -ne 0 ]; then
    exit 1
  fi

  OPTION=$(cat $TMPFILE)

  if [ "x$OPTION" == "xshell" ]; then
    echo "Starting shell..."
    bash
    OPTION=""
  elif [ "x$OPTION" == "xfakd" ]; then
    echo "Running diagnostic..."
    firstaidkit -a
    pause
    OPTION=""
  elif [ "x$OPTION" == "xreboot" ]; then
    reboot
    OPTION=""
  fi

done