summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Lacerda <alacerda@alpinelinux.org>2015-05-15 17:05:34 +0000
committerAlan Lacerda <alacerda@alpinelinux.org>2015-05-15 17:05:34 +0000
commitf1e8ee7a19d56766dafae355297bb67be80b6917 (patch)
treed4b963c77f6b943ad083cf306a04d0f51eb0bfd0
parent5f0586d3f03c3728ee84eb90f9dbab47b3f7f7bb (diff)
downloadsetup-box-0.1.1.tar.bz2
setup-box-0.1.1.tar.xz
setup-box: some adjustmentsv0.1.1
depends now are in APKBUILD fixing typos getting rid of some useless information in usage() added some examples in usage()
-rwxr-xr-xsetup-box66
1 files changed, 30 insertions, 36 deletions
diff --git a/setup-box b/setup-box
index 14664ee..21343a2 100755
--- a/setup-box
+++ b/setup-box
@@ -9,7 +9,6 @@
### DO NOT TOUCH THIS VARIABLE
CONFIG_DIR=@CONFIG_DIR@
JSON_DIR=@JSON_DIR@
-DEPS=@DEPS@
VERSION=@VERSION@
# Variable definition
@@ -29,38 +28,30 @@ create_user="0"
usage () {
cat <<__EOF__
+$(basename $0) $VERSION - Setup a variety Environments
-$(basename $0) $VERSION
-
-Usage: $(basename $0) [options]
-
-A tool to setup a variety of Alpine Linux Environmet
+Usage: $(basename $0) option [argument | desktop]
Options:
- -d Specify one desktop environment
- -g Install a full group
+ -d Specify one of the following desktop environment:
+ mate
+ openbox
+ xfce
+ -g Install a group (see -L)
-h Show this help
-L List all avaliable groups
-l List all avaliable subgroups
- -s Install a specific subgroup
+ -s Install a subgroup (see -l)
-v Show any error - just in case
-V Show $(basename $0) version
-Desktop:
- mate
- openbox
- xfce
-
-Groups (see -L option for a complet list):
- desktop-extras
- pentest
- systools
-
-Subgroups (see -l option for a complet list):
- pentest.voip
- pentest.forensics
- systools.disk
+EXAMPLES:
+ Installing MATE Desktop, Internet applications and Pentest tools:
+ ~# $(basename $0) -d mate -s desktop_extras.internet -g pentest
+ Installing a basic environment with Gparted:
+ ~# $(basename $0) -d openbox -s systools.disk
+
__EOF__
exit 1
}
@@ -78,14 +69,6 @@ __EOF__
logger -i -t $(basename $0) -p 4 "User $(whoami) tried to execute $(basename $0)"
exit 1
fi
- apk add -q --virtual .setup-box $DEPS \
- || exit 126
-}
-
-# Once setup-box has finished its job, we can get rid of all dependencies previously installed
-del_deps() {
- apk del -q .setup-box \
- || exit 126
}
# We need to exclude $desktop_json from the list. This is due to the fact that
@@ -235,7 +218,6 @@ EOF
# Called by -L option
list_meta_groups() {
cat <<__EOF__
-
$(basename $0) $VERSION
Avaliables groups are:
@@ -249,7 +231,6 @@ __EOF__
list_sub_groups() {
cat <<__EOF__
-
$(basename $0) $VERSION
Avaliables subgroups are:
@@ -300,6 +281,15 @@ add_services() {
done
}
+start_services() {
+ for i in $@; do
+ rc-service $i start
+ if [ "$i" == "udev" ]; then
+ rc-service $i-postmount start
+ fi
+ done
+}
+
##
# Main function starts here
main () {
@@ -325,6 +315,7 @@ main () {
case $opt in
d)
create_user="1"
+ echo ARGUMENTO: "$OPTARG"
search_desktop "$OPTARG";;
s)
search_sub_group "$OPTARG";;
@@ -362,11 +353,14 @@ main () {
echo -e "We've created a new user for you: $new_user"
echo -e "****************************************************"
adduser -h /home/$new_user -g "Alpine Linux User" $new_user
+ while [ $? -eq 1 ]; do
+ echo -e "\033[0;31mPasswords mismatch. Try again"
+ passwd $new_user
+ done
echo -e "\033[0m"
fi
-
- # Removing dependencies
- del_deps
+
+ start_services $final_serv
}
main $@ \ No newline at end of file