feat: improvements to simplify script
This commit is contained in:
parent
c4de9f43aa
commit
beffe4d39c
1 changed files with 10 additions and 9 deletions
19
run.sh
19
run.sh
|
@ -23,31 +23,32 @@ function cleanup(){
|
||||||
|
|
||||||
function build () {
|
function build () {
|
||||||
local config="$1"
|
local config="$1"
|
||||||
local location="$2"
|
local configs="./configs"
|
||||||
|
local images="./images"
|
||||||
|
|
||||||
# file:// cannot have relative paths, so use a bit of subsitution to fix
|
# file:// cannot have relative paths, so use a bit of subsitution to fix
|
||||||
if grep -q SKYNET_ROOT_DIR "$config"; then
|
if grep -q SKYNET_ROOT_DIR "$configs/$config.yaml"; then
|
||||||
|
|
||||||
# create a copy with the file
|
# create a copy with the file
|
||||||
cp "$config" "$config.tmp"
|
cp "$configs/$config.yaml" "$configs/$config.tmp"
|
||||||
# sed normally uses / but that conflcts with file paths so use @ instead
|
# sed normally uses / but that conflcts with file paths so use @ instead
|
||||||
sed -i "s@SKYNET_ROOT_DIR@$PWD@g" "$config.tmp"
|
sed -i "s@SKYNET_ROOT_DIR@$PWD@g" "$configs/$config.tmp"
|
||||||
|
|
||||||
# add to tmp tmp_files
|
# add to tmp tmp_files
|
||||||
tmp_files+=("$config.tmp")
|
tmp_files+=("$configs/$config.tmp")
|
||||||
|
|
||||||
# normal command
|
# normal command
|
||||||
distrobuilder build-lxc "$config.tmp" $location
|
distrobuilder build-lxc "$configs/$config.tmp" "$images/$config"
|
||||||
else
|
else
|
||||||
distrobuilder build-lxc $config $location
|
distrobuilder build-lxc "$configs/$config.yaml" "$images/$config"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function main(){
|
function main(){
|
||||||
setup
|
setup
|
||||||
|
|
||||||
build ./configs/base.yaml ./images/base
|
build base
|
||||||
build ./configs/base_trainee.yaml ./images/base_trainee
|
build base_trainee
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue