Thanks, 799, I'll take a look at them when I get a chance.

Ron


On 09/27/2017 03:52 AM, 'One7two99' via qubes-users wrote:
Hello Ron,

Me:
>> I've written a handful scripts which will take the default
>> qubes-templates and apply all updates / packe installation and
>> post-configuration tasks without user interaction.
>> This reduces time rebuilding the system but also allows another backup
>> policy where I only store the data and reinstall everything else from
>> my scripts.
>> If you"re interested I can forward them to you.

Ron:
> I"m not sure if that will help, but I"ll take a look. If I can at least get my files into new
> appvms of the same name, it would do the trick.

Here is a script I am using to rebuild my work-template, which is based on a fedora template. The scripts allows me to install a Qubes 3.2 default and then run all commands to add a new template, update it, install additional packages and even installs some software (here only the VMware Horizon View Client) which is not available in the default repositories.

There is some "overhead" in the script as I'd like to run it even after having it done once. As such it will also remove any existing VM with the same name (qvm-destroy).
qvm-destroy is another scripts:
[content of qvm-destroy]

#!/bin/bash
# Kill a running AppVM and remove it
# Usage: qvm-destroy <Name-of-VM>
echo "Killing VM: $1"
qvm-kill $1
echo "Removing VM: $1"
qvm-remove $1
echo "Waiting for 5s (just to be sure)"
sleep 5s

[content of my create-t-fedora-25-work.sh]
#!/bin/bash
templatebasevm=fedora-25
worktemplatevm=t-fedora-25-work
internetvm=my-untrusted

# Install minimal Fedora 25 template
sudo qubes-dom0-update qubes-template-$templatebasevm

# Remove existing Template VM
./qvm-destroy $worktemplatevm

echo "Clone template to $worktemplatevm"
qvm-clone $templatebasevm $worktemplatevm
# Hide original template
qvm-prefs -s $templatebasevm internal true

echo Launch new template-vm $worktemplatevm
qvm-start --skip-if-running --tray $worktemplatevm
echo "Wait for 10sec until Template VM is up"
sleep 10s
echo "Install updates and additional applications in $worktemplatevm"
qvm-run $worktemplatevm 'xterm -e "sudo dnf -y update && \
   sudo dnf -y install mc nano pass libreoffice gimp && \
   sudo dnf -y install gstreamer gstreamer-plugins-base libffi libpng12 libXSrnSaver"'
echo "Wait until all packages have been installed."
read -p "Press Enter to continue"

# Download VMware Horizon View
echo "Starting $internetvm to download Horizon View"
qvm-start --tray $internetvm
sleep 10s
# FIXME: the qvm-copy-to-vm has the name of the target template ($worktemplatevm)
# hardcoded, as I didn't find a way to use the variable within this line
qvm-run $internetvm 'xterm -e "cd /home/user && wget https://download3.vmware.com/software/view/viewclients/CART17Q2/VMware-Horizon-Client-4.5.0-5650368.x64.bundle && \              mv VMware-Horizon-Client-4.5.0-5650368.x64.bundle VMware-Horizon-Client-4.5.0.bundle && \              qvm-copy-to-vm t-fedora-25-work VMware-Horizon-Client-4.5.0.bundle && \
             sleep 10s"'
echo "(qvm-)Copy file VMware-Horizon-Client-4.5.0.bundle from $internetvm to $worktemplatevm"
read -p "Press Enter to continue"

# Install VMware Horizon View
qvm-run $worktemplatevm 'xterm -e "chmod +x ~/QubesIncoming/my-untrusted/VMware-Horizon-Client-4.5.0.bundle && \              sudo ~/QubesIncoming/my-untrusted/VMware-Horizon-Client-4.5.0.bundle && \              rm /QubesIncoming/my-untrusted/VMware-Horizon-Client-4.5.0.bundle && \
             shutdown -h now"'

You'll find this and also other scripts I use to rebuild my templates and appvms in the attached archive.
Any improvements are welcome.

I'll try to think if I'll add something like backing up the private image file and adding it when rebuilding an appvm makes sense.

[799]
--
You received this message because you are subscribed to the Google Groups "qubes-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to qubes-users+unsubscr...@googlegroups.com <mailto:qubes-users+unsubscr...@googlegroups.com>. To post to this group, send email to qubes-users@googlegroups.com <mailto:qubes-users@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/gWaGUcU_dTBx_dZOXjYj1jHab3dHrtOWk8Fmxg5g7QQlxozzrnywgGdlGro9pnagdfywJ_ztlIwlzboaU6WOrWNCusCjuDdad6jNfkr5z4Q%3D%40protonmail.com <https://groups.google.com/d/msgid/qubes-users/gWaGUcU_dTBx_dZOXjYj1jHab3dHrtOWk8Fmxg5g7QQlxozzrnywgGdlGro9pnagdfywJ_ztlIwlzboaU6WOrWNCusCjuDdad6jNfkr5z4Q%3D%40protonmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/ea995d01-7d88-e1e5-793f-1eacadda9c7a%40shaw.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to