storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/mint/create-data-files.sh (about)

     1  #!/bin/bash -e
     2  #
     3  #  Mint (C) 2017 Minio, Inc.
     4  #
     5  #  Licensed under the Apache License, Version 2.0 (the "License");
     6  #  you may not use this file except in compliance with the License.
     7  #  You may obtain a copy of the License at
     8  #
     9  #      http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  #  Unless required by applicable law or agreed to in writing, software
    12  #  distributed under the License is distributed on an "AS IS" BASIS,
    13  #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  #  See the License for the specific language governing permissions and
    15  #  limitations under the License.
    16  #
    17  
    18  MINT_DATA_DIR="$MINT_ROOT_DIR/data"
    19  
    20  declare -A data_file_map
    21  data_file_map["datafile-0-b"]="0"
    22  data_file_map["datafile-1-b"]="1"
    23  data_file_map["datafile-1-kB"]="1K"
    24  data_file_map["datafile-10-kB"]="10K"
    25  data_file_map["datafile-33-kB"]="33K"
    26  data_file_map["datafile-100-kB"]="100K"
    27  data_file_map["datafile-1.03-MB"]="1056K"
    28  data_file_map["datafile-1-MB"]="1M"
    29  data_file_map["datafile-5-MB"]="5M"
    30  data_file_map["datafile-5243880-b"]="5243880"
    31  data_file_map["datafile-6-MB"]="6M"
    32  data_file_map["datafile-10-MB"]="10M"
    33  data_file_map["datafile-11-MB"]="11M"
    34  data_file_map["datafile-65-MB"]="65M"
    35  data_file_map["datafile-129-MB"]="129M"
    36  
    37  mkdir -p "$MINT_DATA_DIR"
    38  for filename in "${!data_file_map[@]}"; do
    39      echo "creating $MINT_DATA_DIR/$filename"
    40      if ! shred -n 1 -s "${data_file_map[$filename]}" - 1>"$MINT_DATA_DIR/$filename" 2>/dev/null; then
    41          echo "unable to create data file $MINT_DATA_DIR/$filename"
    42          exit 1
    43      fi
    44  done