From 33e7a3ea0dd6d71d3f051f5cef6a3e7fbd0d1c5c Mon Sep 17 00:00:00 2001 From: winloong <21272660+vinloong@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:11:58 +0800 Subject: [PATCH] add switch-auth --- switch-auth.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 switch-auth.sh diff --git a/switch-auth.sh b/switch-auth.sh new file mode 100644 index 0000000..25e671d --- /dev/null +++ b/switch-auth.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +auth_zhiwucloud="bGl4aWFvbWluQGFueGluam95LmNvbTp1Njk4RUsxcGsx" + +auth_anxinyun_ali="aGk1MDA0MDIwMUBhbGl5dW4uY29tOlY5cnRDbnQkZg==" + +cp /root/.docker/config.json.temp /root/.docker/config.json + +case $1 in +"zhiwucloud") + echo "user is $1, use $1's auth " + sed -i "s@==auth==@${auth_zhiwucloud}@g" /root/.docker/config.json + ;; +"anxinyun") + echo "user is $1, use $1's auth " + sed -i "s@==auth==@${auth_anxinyun_ali}@g" /root/.docker/config.json + ;; +*) + echo "user is $1, not found $1's auth " + ;; +esac +