| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
#********************************************************************* |
| 4 |
# |
| 5 |
# get-config-dir-http -- get a tarball of the config dir |
| 6 |
# |
| 7 |
# This script is part of FAI (Fully Automatic Installation) |
| 8 |
# Copyright (C) 2000-2015 Thomas Lange, [email protected] |
| 9 |
# Universitaet zu Koeln |
| 10 |
# |
| 11 |
#********************************************************************* |
| 12 |
# This program is free software; you can redistribute it and/or modify |
| 13 |
# it under the terms of the GNU General Public License as published by |
| 14 |
# the Free Software Foundation; either version 2 of the License, or |
| 15 |
# (at your option) any later version. |
| 16 |
#********************************************************************* |
| 17 |
|
| 18 |
### BEGIN SUBROUTINE INFO |
| 19 |
# Provides-Var: |
| 20 |
# Requires-Var: $FAI_CONFIG_SRC $FAI |
| 21 |
# Suggests-Var: |
| 22 |
# Short-Description: get config space via http |
| 23 |
### END SUBROUTINE INFO |
| 24 |
|
| 25 |
fdir=/var/lib/fai |
| 26 |
|
| 27 |
mkramdisk $fdir |
| 28 |
cd $fdir |
| 29 |
|
| 30 |
# determine basename of tar file to download (later used as class name) |
| 31 |
file=${FAI_CONFIG_SRC##*/} |
| 32 |
base=${file%%.*} |
| 33 |
|
| 34 |
# now download tarball of config space |
| 35 |
echo -n "Getting configuration space tarball from $FAI_CONFIG_SRC ..." |
| 36 |
HOME=/root curl -f -O --retry 3 $FAI_CONFIG_SRC |
| 37 |
ret=$? |
| 38 |
if [ $? -eq 0 ]; then |
| 39 |
echo "done" |
| 40 |
else |
| 41 |
echo "curl error $ret while downloading $FAI_CONFIG_SRC." |
| 42 |
task_error 882 $ret |
| 43 |
fi |
| 44 |
|
| 45 |
# extraxt the downloaded file using ftar. Therefore define a class |
| 46 |
# with the basename of the file |
| 47 |
echo "Extracting config space from $file" |
| 48 |
ftar -c $base -t $FAI -s $fdir . |