I've just updated fluxwant to ask you if you want to quit at any time, so now you can answer 'yes' or 'y' and it will continue, you can answer 'no' or 'n' and it can continue without installing something, and 'quit' or 'q' and you exit cleanly. So here it is -

 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#: Title                : fluxwant
#: Date                 : November 2013
#: Author               : Sharon Kimble
#: Version              : 3.0
#: Times edited         : 14
#: Description          : to easily show a list of programmes, choose one and install it, and then update the 'universal database'
#: Options              : 1, all listed in variables
#; Requirements         : menumaker-0.99.7.tar.gz, in the /programmes directory
#: License              : GNU GPL 3.0 or later
####################################################
# Changelog.
# * 17-11-13 - initial version of the script,
# logs output, added ability to install, and update
# the universal database.
# * 18-11-13 - added the ability to generate a fluxbox menu.
# * 19-11-13 - added the ability to quit part-way through
####################################################
# Variables
logfile="/home/boudiccas/logs/want.txt"
####################################################
exec > >(tee -a $logfile) 2>&1

# Searches the apt-cache
echo "What programmes would you like to see? One word answer please!"
echo
read programme
echo
apt-cache search "$programme"
echo

# Uses apt-cache policy to show info regarding one programme
echo "What programme do you want to see more information of?"
echo
read programme
echo
apt-cache show "$programme" | grep -i description -A 8

apt-cache policy "$programme"   #shows whether installed or not, and repo of it.

# Install it?
echo 
{   
    read -p "Do you want to install this programme? yes/no/quit " ynq
    case $ynq in
        [Yy]* ) sudo apt-get install "$programme";; 
        [Nn]* ) echo;;
    [Qq]* ) exit;;
        * ) echo "Please answer yes or no. ";;
    esac
}

# use updatedb
echo
{    
    read -p "Do you want to update the universal database? yes/no/quit " ynq
   case $ynq in
        [Yy]* ) sudo updatedb;;
        [Nn]* ) echo;;
    [Qq]* ) exit;;
        * ) echo "Please answer yes or no. ";;
    esac
}

echo
{    
    read -p "Do you want to update the fluxbox menu? " yn
   case $yn in
        [Yy]* ) mv ~/.fluxbox/menu ~/.fluxbox/menu-$(/bin/date +%Y%m%d-%R); mmaker fluxbox -f;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no. ";;
    esac
}
exit


Comments

comments powered by Disqus