summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Lacerda <alacerda@alpinelinux.org>2015-04-30 17:02:40 +0000
committerAlan Lacerda <alacerda@alpinelinux.org>2015-04-30 17:02:40 +0000
commitadd01f0e1a1d32ca06ebad37b4bbf4aceec9f6ed (patch)
treebcff713767cdf396cddcd49d819aeb0466dbdb6a
parentaeba8334f46982368b907b8a5f8edf845bfa1254 (diff)
downloadsetup-box-add01f0e1a1d32ca06ebad37b4bbf4aceec9f6ed.tar.bz2
setup-box-add01f0e1a1d32ca06ebad37b4bbf4aceec9f6ed.tar.xz
setup-box: replace -e with -s and now showing error is optional
-rwxr-xr-xsetup-box23
1 files changed, 17 insertions, 6 deletions
diff --git a/setup-box b/setup-box
index b01de5b..86c7633 100755
--- a/setup-box
+++ b/setup-box
@@ -21,7 +21,7 @@ final_packs=""
final_serv=""
### File that contains all desktop-related groups
desktop_json="$JSON_DIR/desktop.json"
-
+show_error="0"
### End of Variables definition
##
#
@@ -37,10 +37,12 @@ A tool to setup a variety of Alpine Linux Environmet
Options:
-d Specify one desktop environment
- -e Install a specific subgroup
-g Install a full group
-h Show this help
-l List all avaliable groups
+ -s Install a specific subgroup
+ -v Show any error - just in case
+ -V Show $(basename $0) version
Desktop:
gparted
@@ -82,7 +84,7 @@ for i in $(ls $JSON_DIR/*.json); do
# Function to define in what json files perform the search for the
# group to be installed
-## Called by -e option
+## Called by -s option
search_sub_group() {
for f in $json_files; do
if [ "${1%.*}" != "desktop" ]; then
@@ -171,6 +173,8 @@ __EOF__
for i in $(echo $json_files | sed 's/.json//g' | tr ' ' \\n ); do
basename $i
done
+
+ exit 1
}
# Function to remove duplicated packages from the list of packages
@@ -201,7 +205,9 @@ add_services() {
# Main function starts here
main () {
# first of all lets redirect any error to the limbo
- #exec 2&> /dev/null
+ if [ "$show_error" == "0" ]; then
+ exec 2&> /dev/null
+ fi
# Harvesting for all valid JSON files
# Getting ready to be used...
@@ -213,12 +219,15 @@ main () {
fi
# If there is any argument... let's work
- while getopts "d:e:g:hl" opt ; do
+ while getopts "d:e:g:hlvV" opt ; do
case $opt in
d) search_desktop "$OPTARG";;
- e) search_sub_group "$OPTARG";;
+ s) search_sub_group "$OPTARG";;
g) search_meta_group "$OPTARG";;
l) list_groups;;
+ v) show_error="1";;
+ V) echo $(basename $0) $VERSION
+ exit 1;;
h) usage;;
*) usage;;
esac
@@ -237,6 +246,8 @@ main () {
#add_services $final_serv
echo Servicos: $final_serv
+ echo "Show Errors: $show_error"
+
# Removing dependencies
# deldep
}