create_template_list.sh enhancements
- allow to pass environment variable '$YUM_OPTS' (to allow adding for example '--assumeyes') - only try to uninstall existing template package if already installed to avoid failing and unnecessary output and prompts - output - refactoring
This commit is contained in:
parent
24f3f78e72
commit
bdd06c77af
@ -78,15 +78,24 @@ for file_name in ${files[@]}; do
|
||||
|
||||
if [ ! -e "${file_name}" ]; then
|
||||
echo "Copying ${file_name} from ${name} to ${PWD}/${file_name}..."
|
||||
qvm-run --pass-io "${name}" "cat ${path}/${file_name}" > "${file_name}"
|
||||
qvm-run --pass-io "${name}" "cat ${path}/${file_name}" > "${PWD}/${file_name}"
|
||||
fi
|
||||
|
||||
sudo yum erase $(echo "${file_name}" | sed -r "s/(${version}).+$//") && {
|
||||
sudo yum install "${file_name}" && {
|
||||
rm -f "${file_name}"
|
||||
}
|
||||
}
|
||||
package_name="$(echo "${file_name}" | sed -r "s/(${version}).+$//")"
|
||||
|
||||
if sudo yum $YUM_OPTS list installed "$package_name" >/dev/null 2>&1 ; then
|
||||
echo "Uninstalling package ${package_name}..."
|
||||
sudo yum $YUM_OPTS erase "$package_name"
|
||||
fi
|
||||
|
||||
echo "Installing file ${file_name}..."
|
||||
if sudo yum $YUM_OPTS install "${file_name}" ; then
|
||||
echo "Deleting ${PWD}/${file_name}..."
|
||||
rm -f "${file_name}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Done."
|
||||
EOF
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user