diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2011-07-14 09:49:46 -0700 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2011-07-14 09:49:46 -0700 |
commit | 6dad3eb2bbe3901a85f060908ca77dfb221f42a5 (patch) | |
tree | c3badd066c2dd9b86360cb4f3eb94097d1b0d129 /scripts/install | |
parent | dc7cd1a9c091698372750443ddfbdc3fd11f3369 (diff) | |
download | vyatta-cfg-system-6dad3eb2bbe3901a85f060908ca77dfb221f42a5.tar.gz vyatta-cfg-system-6dad3eb2bbe3901a85f060908ca77dfb221f42a5.zip |
Bugfix 5856: Add username and password options.
In order to allow username and password parameters in the
corresponding op mode command, we allow username and password to be
specified on the install-image command line.
Diffstat (limited to 'scripts/install')
-rwxr-xr-x | scripts/install/install-image | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/install/install-image b/scripts/install/install-image index fd4fee7d..5abef7ca 100755 --- a/scripts/install/install-image +++ b/scripts/install/install-image @@ -56,8 +56,14 @@ fetch_iso_by_url () mkdir $TEMP_DIR echo "Trying to fetch ISO file from $NEW_ISO" + if [ -n "$USERNAME" ]; then + auth="-u $USERNAME:$PASSWORD" + else + auth="" + fi + filename="${TEMP_DIR}/${NEW_ISO##*/}" - curl -f -o $filename $NEW_ISO + curl $auth -f -o $filename $NEW_ISO if [ $? -ne 0 ]; then echo "Unable to fetch ISO from $NEW_ISO" rm -f $filename @@ -203,6 +209,15 @@ install_existing () # running system. NEW_ISO=$1 +# Username and password are optional +if [ $# -eq 3 ]; then + USERNAME=$2 + PASSWORD=$3 +else + USERNAME="" + PASSWORD="" +fi + if [ `whoami` != 'root' ] ; then fail_exit 'This script must be run with root privileges.' fi |