refactor argument parsing
This commit is contained in:
parent
34499ac38c
commit
a038dc96be
63
install.sh
63
install.sh
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# install.sh
|
# install.sh
|
||||||
# This script installs my basic setup for a debian laptop
|
# This script installs my basic setup for a debian machine
|
||||||
|
|
||||||
USERNAME=fschl
|
USERNAME=fschl
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ base_applications() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_server_base() {
|
install_server_base() {
|
||||||
|
|
||||||
echo "update and installing server base tools..."
|
echo "update and installing server base tools..."
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
@ -244,7 +243,6 @@ install_golang() {
|
||||||
go get golang.org/x/tools/cmd/goimports
|
go get golang.org/x/tools/cmd/goimports
|
||||||
go get golang.org/x/tools/cmd/gorename
|
go get golang.org/x/tools/cmd/gorename
|
||||||
|
|
||||||
go get github.com/FiloSottile/vendorcheck
|
|
||||||
go get github.com/nsf/gocode
|
go get github.com/nsf/gocode
|
||||||
#done
|
#done
|
||||||
)
|
)
|
||||||
|
@ -310,36 +308,39 @@ main() {
|
||||||
local cmd=$1
|
local cmd=$1
|
||||||
|
|
||||||
if [[ -z "$cmd" ]]; then
|
if [[ -z "$cmd" ]]; then
|
||||||
echo "Usage: \n base | desktop | server | dotfiles | compose | go"
|
echo "Usage: \n base | desktop | server | dotfiles | update-docker | go"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: refactor to case
|
case "$cmd" in
|
||||||
if [[ $cmd == "compose" ]]; then
|
base)
|
||||||
install_compose
|
apt_sources
|
||||||
elif [[ $cmd == "base" ]]; then
|
base_applications
|
||||||
apt_sources
|
install_docker
|
||||||
|
sudo groupadd docker
|
||||||
base_applications
|
sudo adduser -aG docker "$USERNAME"
|
||||||
|
install_compose
|
||||||
install_docker
|
;;
|
||||||
|
dotfiles)
|
||||||
install_compose
|
get_dotfiles
|
||||||
elif [[ $cmd == "docker" ]]; then
|
;;
|
||||||
install_docker
|
server)
|
||||||
elif [[ $cmd == "dotfiles" ]]; then
|
install_server_base
|
||||||
get_dotfiles
|
;;
|
||||||
elif [[ $cmd == "go" ]]; then
|
desktop)
|
||||||
install_golang
|
install_i3
|
||||||
elif [[ $cmd == "goprojects" ]]; then
|
if [ -f "./get_private_stuff.sh" ]; then
|
||||||
get_public_go_projects
|
source get_private_stuff.sh
|
||||||
elif [[ $cmd == "server" ]]; then
|
fi
|
||||||
install_server_base
|
;;
|
||||||
elif [[ $cmd == "desktop" ]]; then
|
update-docker)
|
||||||
install_i3
|
# install_docker
|
||||||
if [ -f "./get_private_stuff.sh" ]; then
|
install_compose
|
||||||
source get_private_stuff.sh
|
;;
|
||||||
fi
|
go)
|
||||||
fi
|
install_golang
|
||||||
|
get_public_go_projects
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
Loading…
Reference in New Issue