From 4869aef72b8a447ebc92b371817930d5dd0e9b83 Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Wed, 4 Sep 2019 21:05:26 +0800 Subject: [PATCH] fix docker param --- README.md | 15 ++++++--------- cmd/root.go | 2 +- install/install.go | 5 ++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f00341a..ffb7d5a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ install container from url: location file: ```shell script container-install install \ - --docker T \ + --d \ --host 172.16.213.131 \ --host 172.16.213.132 \ --user root \ @@ -21,7 +21,7 @@ install container from url: remote url: ```shell script container-install install \ - --docker T \ + --d \ --host 172.16.213.131 \ --host 172.16.213.132 \ --user root \ @@ -37,7 +37,6 @@ install container from url: location file: ```shell script container-install install \ - --docker F \ --host 172.16.213.131 \ --host 172.16.213.132 \ --user root \ @@ -50,7 +49,6 @@ install container from url: remote url: ```shell script container-install install \ - --docker F \ --host 172.16.213.131 \ --host 172.16.213.132 \ --user root \ @@ -65,7 +63,7 @@ install container from url: uninstall container: ```shell script container-install uninstall \ - --docker T \ + --d \ --host 172.16.213.131 \ --host 172.16.213.132 \ --user root \ @@ -77,7 +75,6 @@ uninstall container: uninstall container: ```shell script container-install uninstall \ - --docker F \ --host 172.16.213.131 \ --host 172.16.213.132 \ --user root \ @@ -93,14 +90,14 @@ use --pk=/root/.ssh/id_rsa is private key login ### Print Download Url print download url for docker: ```shell script - container-install print --docker T + container-install print --d ``` the docker Newest version is v19.03.0. ex: ```shell script -cuisongliu@cuisongliu-PC:~$ container-install print --docker T +cuisongliu@cuisongliu-PC:~$ container-install print --d https://download.docker.com/linux/static/stable/x86_64/docker-17.03.0-ce.tgz https://download.docker.com/linux/static/stable/x86_64/docker-17.03.1-ce.tgz https://download.docker.com/linux/static/stable/x86_64/docker-17.03.2-ce.tgz @@ -132,7 +129,7 @@ https://download.docker.com/linux/static/stable/x86_64/docker-19.03.0.tgz the containerd Newest version is v1.2.7 ex: ```shell script -cuisongliu@cuisongliu-PC:~$ container-install print --docker F +cuisongliu@cuisongliu-PC:~$ container-install print https://github.com/containerd/containerd/releases/download/v1.1.0/containerd-1.1.0.linux-amd64.tar.gz https://github.com/containerd/containerd/releases/download/v1.1.1/containerd-1.1.1.linux-amd64.tar.gz https://github.com/containerd/containerd/releases/download/v1.1.2/containerd-1.1.2.linux-amd64.tar.gz diff --git a/cmd/root.go b/cmd/root.go index 8269b8d..637aaf4 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -44,5 +44,5 @@ func init() { // Here you will define your flags and configuration settings. // Cobra supports persistent flags, which, if defined here, // will be global for your application. - rootCmd.PersistentFlags().StringVar(&install.Docker, "docker", "T", "install the container runtime is docker?if false,the runtime is containerd(T/F)") + rootCmd.PersistentFlags().BoolVarP(&install.Docker, "docker", "d", false, "install the container runtime is docker?if false,the runtime is containerd(T/F)") } diff --git a/install/install.go b/install/install.go index 6b50bdb..2a6a1b8 100644 --- a/install/install.go +++ b/install/install.go @@ -2,11 +2,10 @@ package install import ( "github.com/cuisongliu/container-install/install/command" - "strings" "sync" ) -var Docker string +var Docker bool var Hosts []string const ( @@ -66,7 +65,7 @@ func (s Installer) Print() { } func IsDocker() bool { - return strings.ToUpper(Docker) == "T" + return Docker } func factory(itype int, host string) {