debian: Modified template install script to read better
This commit is contained in:
parent
d682f0bfaa
commit
9efcf913e7
@ -1,48 +1,53 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# vim: set ts=4 sw=4 sts=4 et :
|
||||||
|
|
||||||
#
|
#
|
||||||
# Creates a small script to copy to dom0 to retrieve the generated template rpm's
|
# Creates a small script to copy to dom0 to retrieve the generated template rpm's
|
||||||
#
|
#
|
||||||
|
|
||||||
TEMPLATES="./rpm/install-templates.sh"
|
template_dir="$(readlink -m ./rpm/install-templates.sh)"
|
||||||
|
files=( $(ls rpm/noarch) )
|
||||||
write() {
|
|
||||||
echo "$1" >> "$TEMPLATES"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -x /usr/sbin/xenstore-read ]; then
|
|
||||||
XENSTORE_READ="/usr/sbin/xenstore-read"
|
|
||||||
else
|
|
||||||
XENSTORE_READ="/usr/bin/xenstore-read"
|
|
||||||
fi
|
|
||||||
|
|
||||||
TEMPLATES="$(readlink -m $TEMPLATES)"
|
|
||||||
VERSION="-$(cat ./version)"
|
|
||||||
name=$($XENSTORE_READ name)
|
name=$($XENSTORE_READ name)
|
||||||
path="$(readlink -m .)"
|
|
||||||
files=$(ls rpm/noarch)
|
|
||||||
|
|
||||||
#
|
# -----------------------------------------------------------------------------
|
||||||
# Write to install-templates
|
# Write $vars
|
||||||
#
|
# -----------------------------------------------------------------------------
|
||||||
|
cat << EOF > "${template_dir}"
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
echo "#!/bin/bash" > "$TEMPLATES"
|
# Use the following command in DOM0 to retreive this file:
|
||||||
write ""
|
# qvm-run --pass-io ${name} 'cat ${template_dir}' > install-templates.sh
|
||||||
|
|
||||||
|
files="
|
||||||
|
$(printf "%s \n" ${files[@]})
|
||||||
|
"
|
||||||
|
|
||||||
|
path="$(readlink -m .)/rpm/noarch"
|
||||||
|
version="-$(cat ./version)"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Write installation function
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
cat << 'EOF' >> "${template_dir}"
|
||||||
|
|
||||||
for file in ${files[@]}; do
|
for file in ${files[@]}; do
|
||||||
write "qvm-run --pass-io development-qubes 'cat ${path}/rpm/noarch/${file}' > ${file}"
|
if [ ! -e ${file} ]; then
|
||||||
write ""
|
qvm-run --pass-io development-qubes "cat ${path}/${file}" > ${file}
|
||||||
write "sudo yum erase $(echo "$file" | sed -r "s/($VERSION).+$//")"
|
fi
|
||||||
write ""
|
|
||||||
write "sudo yum install ${file}"
|
sudo yum erase $(echo "${file}" | sed -r "s/(${version}).+$//") && {
|
||||||
write ""
|
sudo yum install ${file} && {
|
||||||
write ""
|
rm -f ${file}
|
||||||
|
}
|
||||||
|
}
|
||||||
done
|
done
|
||||||
|
EOF
|
||||||
|
|
||||||
write "# Use the following command in DOM0 to retreive this file:"
|
# -----------------------------------------------------------------------------
|
||||||
write "# qvm-run --pass-io $name 'cat ${TEMPLATES}' > install-templates.sh"
|
# Display instructions
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
echo "Use the following command in DOM0 to retreive this file:"
|
echo "Use the following command in DOM0 to retreive this file:"
|
||||||
echo "qvm-run --pass-io $name 'cat ${TEMPLATES}' > install-templates.sh"
|
echo "qvm-run --pass-io ${name} 'cat ${template_dir}' > install-templates.sh"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user