Skip to content
Snippets Groups Projects
Commit cd857002 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

use instance syntax as directory name

parent 8f35d6e4
No related branches found
No related tags found
No related merge requests found
......@@ -53,11 +53,9 @@ fi
mod="${target[0]}"
mod="${mod%%@*}"
mod_name="${mod}"
mod="${mod%%@*}@"
insta="${target[0]}"
insta="${insta##*@}"
mod_name="${mod_name}${insta}"
if [[ ! -d ${module_system}/${mod} ]]; then
die "fatal: module ${mod} doesn't exist"
......@@ -77,34 +75,34 @@ if [[ -z "${insta}" ]];then
die "fatal: instance for ${mod} is not set"
fi
if [[ -d ${service_system}/${mod_name} ]]; then
if [[ -d ${service_system}/${mod} ]]; then
if (( !$force )) ; then
die "fatal: ${service_system}/${mod_name} already exist"
die "fatal: ${service_system}/${mod} already exist"
else
rm -rf ${service_system}/${mod_name} || die "fatal: unable to remove ${service_system}/${mod_name}"
rm -rf ${service_system}/${mod} || die "fatal: unable to remove ${service_system}/${mod}"
fi
fi
cp -rT ${module_system}/${mod} ${service_system}/${mod_name} || die "fatal: unable to cp ${module_system}/${mod} to ${service_system}/${mod_name}"
cp -rT ${module_system}/${mod} ${service_system}/${mod} || die "fatal: unable to cp ${module_system}/${mod} to ${service_system}/${mod}"
## @MOD@ in file
for i in $(find ${service_system}/${mod_name} -mindepth 1 -type f);do
sed -i "s:@MOD@:${insta}:g" $i || die "fatal: unable to sed ${i}"
## @I in file
for i in $(find ${service_system}/${mod} -mindepth 1 -type f);do
sed -i "s:@I:${insta}:g" $i || die "fatal: unable to sed ${i}"
done
## change directory name
for i in $(find ${service_system}/${mod_name} -mindepth 1 -type d|grep -v "configure");do
mv $i $(66-echo -- ${i}|sed "s:@MOD@:${insta}:g") || die "fatal: unable to move ${i} to $(echo ${i}|sed "s:@MOD@:${insta}:g")"
for i in $(find ${service_system}/${mod} -mindepth 1 -type d|grep -v "configure");do
mv $i $(66-echo -- ${i}|sed "s:@M:${insta}:g") || die "fatal: unable to move ${i} to $(echo ${i}|sed "s:@M:${insta}:g")"
done
## change file name
for i in $(find ${service_system}/${mod_name} -mindepth 1 -type f|grep -v "configure");do
mv $i $(66-echo -- ${i}|sed "s:@MOD@:${insta}:g") || die "fatal: unable to move ${i} to $(echo ${i}|sed "s:@MOD@:${insta}:g")"
for i in $(find ${service_system}/${mod} -mindepth 1 -type f|grep -v "configure");do
mv $i $(66-echo -- ${i}|sed "s:@M:${insta}:g") || die "fatal: unable to move ${i} to $(echo ${i}|sed "s:@M:${insta}:g")"
done
## run .configure scripts
if [[ -x ${service_system}/${mod_name}/.configure/configure ]]; then
cd ${service_system}/${mod_name}/.configure/
${service_system}/${mod_name}/.configure/configure ${insta} || die "fatal: unable to configure ${service_system}/${mod_name}"
rm -rf ${service_system}/${mod_name}/.configure || die "fatal: unable to remove ${service_system}/${mod_name}/.configure"
if [[ -x ${service_system}/${mod}/.configure/configure ]]; then
cd ${service_system}/${mod}/.configure/
${service_system}/${mod}/.configure/configure ${insta} || die "fatal: unable to configure ${service_system}/${mod}"
rm -rf ${service_system}/${mod}/.configure || die "fatal: unable to remove ${service_system}/${mod}/.configure"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment