github.com/minio/console@v1.4.1/web-app/tests/scripts/initialize-env.sh (about)

     1  # This file is part of MinIO Console Server
     2  # Copyright (c) 2022 MinIO, Inc.
     3  # # This program is free software: you can redistribute it and/or modify
     4  # it under the terms of the GNU Affero General Public License as published by
     5  # the Free Software Foundation, either version 3 of the License, or
     6  # (at your option) any later version.
     7  # # This program is distributed in the hope that it will be useful,
     8  # but WITHOUT ANY WARRANTY; without even the implied warranty of
     9  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    10  # GNU Affero General Public License for more details.
    11  # # You should have received a copy of the GNU Affero General Public License
    12  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    13  
    14  SCRIPT_DIR=$(dirname "$0")
    15  export SCRIPT_DIR
    16  source "${SCRIPT_DIR}/common.sh"
    17  
    18  __init__() {
    19    export TIMESTAMP=$(date "+%s")
    20    echo $TIMESTAMP >web-app/tests/constants/timestamp.txt
    21    export GOPATH=/tmp/gopath
    22    export PATH=${PATH}:${GOPATH}/bin
    23  
    24    ARCH="$(uname -m)"
    25    case $ARCH in
    26    'i386')
    27      ARCH='amd64'
    28      alias ls='ls --color=auto'
    29      ;;
    30    'x86_64')
    31      ARCH='amd64'
    32      alias ls='ls -G'
    33      ;;
    34    'arm')
    35      ARCH='arm64'
    36      ;;
    37    *) ;;
    38    esac
    39  
    40    echo $ARCH
    41  
    42    OS="$(uname)"
    43    case $OS in
    44    'Linux')
    45      OS='linux'
    46      alias ls='ls --color=auto'
    47      ;;
    48    'FreeBSD')
    49      OS='freebsd'
    50      alias ls='ls -G'
    51      ;;
    52    'WindowsNT')
    53      OS='windows'
    54      ;;
    55    'Darwin')
    56      OS='darwin'
    57      ;;
    58    'SunOS')
    59      OS='solaris'
    60      ;;
    61    'AIX') ;;
    62    *) ;;
    63    esac
    64  
    65    curl -sLO "https://dl.min.io/client/mc/release/$OS-$ARCH/mc" -o mc
    66    chmod +x mc
    67    mv mc /usr/local/bin
    68  
    69    add_alias
    70  }
    71  
    72  main() {
    73    create_policies
    74    create_users
    75    assign_policies
    76  }
    77  
    78  (__init__ "$@" && main "$@")