added options

This commit is contained in:
Jonas Forsberg 2020-08-03 14:03:36 +02:00
parent 0eb8ef355c
commit 0b02b61caa
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9
2 changed files with 69 additions and 5 deletions

View File

@ -47,3 +47,8 @@ If you want you can add a remote repository make sure that it's secure if you ma
dotf remote add origin <username>@git.domain.tld/dotfiles.git dotf remote add origin <username>@git.domain.tld/dotfiles.git
dotf push dotf push
``` ```
# To initialize my desktop run
```bash
bash <(curl -sL https://git.rre.nu/jonas/dotfiles/raw/branch/master/bin/initDesktop)
```

View File

@ -16,8 +16,21 @@ DOTFILES_RENAME_EXISTING_FILES=(
set -aeo pipefail set -aeo pipefail
function printHelp(){
cat << EOF
Usage ${0##*/} [options..]
-h,-?, --help Show help and exit
-f, --firefox configure firefox and install addons
-g, --gnome configure gnome and install extentions
-d, --dotfiles configure dotfiles
-s, --salt run a masterless salt-call
-y, --yes answer 'yes' on all questions
EOF
}
function asktobreak(){ function asktobreak(){
if [[ "$INITDESKTOP_YES" == 1 ]];then if [[ "$ANSWER_YES" == true ]];then
printf "\n" printf "\n"
return 1 return 1
fi fi
@ -104,9 +117,55 @@ function firefox_addons(){
exec $HOME/bin/install_firefox_addon exec $HOME/bin/install_firefox_addon
} }
setup_dotfiles #initialize all options
do_salt_call ALL=true
gnome_key_bindings FIREFOX=false
firefox_addons GNOME=false
SALT=false
DOTFILES=false
ANSWER_YES=false
while :; do
case $1 in
-h|-\?|--help)
printHelp
exit
;;
-f|--firefox)
FIREFOX=true
ALL=false
;;
-g|--gnome)
GNOME=true
ALL=false
;;
-s|--salt)
SALT=true
ALL=false
;;
-d|--dotfiles)
DOTFILES=true
ALL=false
;;
-y|--yes)
ANSWER_YES=true
;;
--) #End of all options
shift
break
;;
-?*)
printf "'$1' is not a valid option\n" >&2
exit 1
;;
*) #Break out of case, no more options
break
esac
shift
done
[[ $ALL == true ]] || [[ $DOTFILES == true ]] && setup_dotfiles
[[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call
[[ $ALL == true ]] || [[ $GNOME == true ]] && gnome_key_bindings
[[ $ALL == true ]] || [[ $FIREFOX == true ]] && firefox_addons
printf "\n DONE!!!!!!!\n" printf "\n DONE!!!!!!!\n"