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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 USER_CONFIG_NAME="user_config.yaml"
18 CLOUD_CONFIGS="/tmp/cloud_configs"
20 source /usr/lib/installmedia-lib.sh
22 FLOPPYMOUNT="/tmp/floppy"
24 warn "copy_floppy_config: Checking if there are any floppy devices and cloud user yaml files in it."
25 if [ -d ${CLOUD_CONFIGS} ];then
26 warn "copy_floppy_config: Seems Configs are fetched from CD. Returning from this module"
32 # Define function to copy files to /tmp/cloud_configs
33 function copyfilesfromfloppy() {
34 mount -o ro ${floppydev} $FLOPPYMOUNT
35 if [ ! -e "$FLOPPYMOUNT/$USER_CONFIG_NAME" ];then
36 warn "This filesystem does not contain user config... bailing out"
40 warn "copy files in ${floppydev} to ${CLOUD_CONFIGS}..."
41 mkdir -p ${CLOUD_CONFIGS}
42 cp -rf $FLOPPYMOUNT/* ${CLOUD_CONFIGS}
48 for device in "${hd_devices[@]}"; do
49 if ( is_removable $device ); then
50 #This device is a removable device. Check if it contains user_config
51 floppydev="/dev/${device}"
52 if ( copyfilesfromfloppy ); then
53 warn "copy_floppy_config: Device found on ${floppydev}"
61 if [ -z ${floppydev} ]; then
62 warn "copy_floppy_config: No floppy device found"
64 warn "copy_floppy_config: Cloud configurations copied to ${CLOUD_CONFIGS}"