Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qubes Builder: install-templates.sh wants to install the 'same' image multiple times #1109

Closed
adrelanos opened this issue Aug 8, 2015 · 6 comments
Labels
C: builder Qubes Builder T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Milestone

Comments

@adrelanos
Copy link
Member

Any idea how this can happen? User error or script bug?

#!/bin/bash

# Use the following command in DOM0 to retreive this file:
# qvm-run --pass-io qubes-build 'cat /home/user/qubes-builder/qubes-src/linux-template-builder/rpm/install-templates.sh' > install-templates.sh

files="
qubes-template-whonix-gw-3.0.3-201508061857.noarch.rpm 
qubes-template-whonix-gw-3.0.3-201508071530.noarch.rpm 
qubes-template-whonix-gw-3.0.3-201508080112.noarch.rpm 
qubes-template-whonix-ws-3.0.3-201508071541.noarch.rpm 
qubes-template-whonix-ws-3.0.3-201508080142.noarch.rpm 
"

path="/home/user/qubes-builder/qubes-src/linux-template-builder/rpm/noarch"
version="-3.0.3"
name="qubes-build"

for file in ${files[@]}; do
    if [ ! -e ${file} ]; then
        echo "Copying ${file} from ${name} to ${PWD}/${file}..."
        qvm-run --pass-io ${name} "cat ${path}/${file}" > ${file}
    fi

    sudo yum erase $(echo "${file}" | sed -r "s/(${version}).+$//") && {
        sudo yum install ${file} && {
            rm -f ${file}
        }
    }
done
@nrgaway
Copy link

nrgaway commented Aug 8, 2015

On 7 August 2015 at 22:23, Patrick Schleizer notifications@github.com
wrote:

Any idea how this can happen? User error or script bug?

#!/bin/bash

Use the following command in DOM0 to retreive this file:

qvm-run --pass-io qubes-build 'cat /home/user/qubes-builder/qubes-src/linux-template-builder/rpm/install-templates.sh' > install-templates.sh

files="
qubes-template-whonix-gw-3.0.3-201508061857.noarch.rpm
qubes-template-whonix-gw-3.0.3-201508071530.noarch.rpm
qubes-template-whonix-gw-3.0.3-201508080112.noarch.rpm
qubes-template-whonix-ws-3.0.3-201508071541.noarch.rpm
qubes-template-whonix-ws-3.0.3-201508080142.noarch.rpm
"

path="/home/user/qubes-builder/qubes-src/linux-template-builder/rpm/noarch"
version="-3.0.3"
name="qubes-build"

for file in ${files[@]}; do
if [ ! -e ${file} ]; then
echo "Copying ${file} from ${name} to ${PWD}/${file}..."
qvm-run --pass-io ${name} "cat ${path}/${file}" > ${file}
fi

sudo yum erase $(echo "${file}" | sed -r "s/(${version}).+$//") && {
    sudo yum install ${file} && {
        rm -f ${file}
    }
}

done

It looks like you built whonix-gw 5 times. The script just adds whatever
is present in the linux-template-builder/rpm/noarch directory. I often
clean up those images once in a while.

@adrelanos
Copy link
Member Author

Yes.

Can we make it pass only the most recent images?

Or have only one image in linux-template-builder/rpm/noarch at a time? At least if it's the very same version?

@nrgaway
Copy link

nrgaway commented Aug 8, 2015

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 08/08/2015 07:57 AM, Patrick Schleizer wrote:

Yes. > > Can we make it pass only the most recent images? > > Or have only
one image in linux-template-builder/rpm/noarch at a time? At least if
it's the very same version? > > --- > Reply to this email directly or
view it on GitHub: >
#1109 (comment)
Passing all the most recent images would be really nice IMO. I often
build 8+ templates at a time, then I just add -y to the install.sh to
remove/add the templates in dom0.

You are the shell genius, you want to take a stab at modifying
'create_template_list.sh', or I can add it to my TODO list?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVxj/AAAoJEELOese9Ajr6BkkP/j6vXkxwtw06VkxhBAwalKk2
TNl4LN9zz2FWhornn3egHDP2b+PwTQJFTf9S+NfBv+ur3zsb+sB1U2nvdMsOwu4L
yFegl6SiiCKjX08XzZ8g+TWiNkMnsCKcADk8L4p72jz4+gEhXdFPUSb8ScpZhWbB
VJPS3nxxVGaqyUKfGsnQk2q+FqRWSKcVy/iZNYOoQ6QsXzsAa/vqBIL3KRrmATXg
Qh5o8EHYwpd1nq2IKiuIEMdTP7y2PpQ7zQqiPQS8qoQxCRl81JNX0cBtoEIKLykr
PdHIAVEZL/vcxXQgOoqk5iIq16tDyCtBxaYC690C4Yh58v1ULRw64T/SOw7n+89H
g3IkYKVofEBGp0uFXiXhjj+lMsbFf6aagalC3DNybbOIhq26iFCzthalK5FKQ8nw
Bl/e/vrXE4GBQ34fY2m3L12Vzu57z1yes7Uw0jutSnLTnqv3DqA/VXuqo0HuLdoA
GopYH1oq6K/CxRsAmCUG0sIqrbjPhASySQhuuiZoBzAKOabNAj32HB9Z4HNA86iM
Cr9jDLblBF2SVl1wP4kXJAiMcC+Ofls3J3R6KANsepRyAtSFnx3n2ed5Wyf10v81
DSRqwNXiPUjxjlXP1bH9YRxrEANIXzfN0X62dx303ww6M96oRk2Y5vaZG1ORXRdl
y0reQGcxjTCTZjA0RsNv
=oPdF
-----END PGP SIGNATURE-----

@unman
Copy link
Member

unman commented Aug 9, 2015

I think it would be a mistake to restrict the list to the latest builds.
Just because you've built it doesnt mean you want to install it, and if you build multiple templates at the same time you might want to be selective in which versions you install of different templates.
There has to be some user choice - either by moving templates out of rpm/noarch or by commenting the files list in install-templates.sh. (This is what I do.)
A better approach might be to have the full list of available files provided, already commented out, and then have the user select those to be installed.

@adrelanos
Copy link
Member Author

A better approach might be to have the full list of available files provided, already commented out, and then have the user select those to be installed.

Or have all out commented by default with the exception of the most recent 'same' ones?

You are the shell genius, you want to take a stab at modifying 'create_template_list.sh', or I can add it to my TODO list?

I don't mind either way. Whoever gets to work on this first.

@marmarek marmarek added this to the Release 3.1 milestone Sep 2, 2015
@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. C: builder Qubes Builder labels Sep 2, 2015
adrelanos pushed a commit to adrelanos/qubes-linux-template-builder that referenced this issue Sep 20, 2015
…me' image multiple times'.

- By default, add only newest versions to the list of files to be installed.
- Add older versions commented out by default.
- Do not try to install out commented versions.
- Renamed variable file to file_name ['file' is a unix standard utility].
- Enabled errexit.
- Refactoring, keep write variables part simpler by just writing, not determining variables contents.
- use more quotes

Fixes QubesOS/qubes-issues#1109.
@adrelanos
Copy link
Member Author

Pull request attached.

marmarek added a commit to marmarek/old-qubes-linux-template-builder that referenced this issue Oct 6, 2015
* origin/pr/10:
  - Fixed 'Qubes Builder: install-templates.sh wants to install the 'same' image multiple times'.

Fixes QubesOS/qubes-issues#1109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: builder Qubes Builder T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

No branches or pull requests

4 participants