Skip to content

Remove duplication in installation scripts #44

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

Merged
merged 3 commits into from
Feb 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Known Issues
### VMware Tools

The official VMware Tools do not currently support Arch Linux, and the
[Open Virtual Machine Tools](http://open-vm-tools.sourceforge.net/)
[Open Virtual Machine Tools](https://github.com/vmware/open-vm-tools)
(open-vm-tools) require extensive patching in order to compile correctly
with a Linux 3.11 series kernel. So for the time being, I have not
included support for the tools.
Expand Down
79 changes: 46 additions & 33 deletions arch-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,87 @@
},
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"guest_os_type": "ArchLinux_64",
"guest_additions_mode": "disable",
"type": "parallels-iso",
"parallels_tools_flavor": "lin",
"parallels_tools_mode": "attach",
"guest_os_type": "linux-2.6",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"http_directory": "srv",
"boot_wait": "5s",
"boot_command": [
"<enter><wait10><wait10>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/install-virtualbox.sh<enter><wait5>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/poweroff.timer<enter><wait5>",
"/usr/bin/bash ./install-virtualbox.sh<enter>"
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/install-base.sh<enter><wait5>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/poweroff.timer<enter><wait5>",
"/usr/bin/bash ./install-base.sh<enter>"
],
"disk_size": 20480,
"hard_drive_interface": "sata",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_timeout": "{{user `ssh_timeout`}}",
"ssh_timeout": "{{ user `ssh_timeout` }}",
"shutdown_command": "sudo systemctl start poweroff.timer"
},
{
"type": "vmware-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"type": "virtualbox-iso",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"guest_os_type": "ArchLinux_64",
"guest_additions_mode": "disable",
"http_directory": "srv",
"boot_wait": "5s",
"boot_command": [
"<enter><wait10><wait10>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/install-vmware.sh<enter><wait5>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/poweroff.timer<enter><wait5>",
"/usr/bin/bash ./install-vmware.sh<enter>"
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/install-base.sh<enter><wait5>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/poweroff.timer<enter><wait5>",
"/usr/bin/bash ./install-base.sh<enter>"
],
"disk_size": 20480,
"hard_drive_interface": "sata",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_timeout": "{{user `ssh_timeout`}}",
"ssh_timeout": "{{ user `ssh_timeout` }}",
"shutdown_command": "sudo systemctl start poweroff.timer"
},
{
"type": "parallels-iso",
"parallels_tools_flavor": "lin",
"parallels_tools_mode": "attach",
"guest_os_type": "linux-2.6",
"iso_url": "{{user `iso_url`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"type": "vmware-iso",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"http_directory": "srv",
"boot_wait": "5s",
"boot_command": [
"<enter><wait10><wait10>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/install-parallels.sh<enter><wait5>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/poweroff.timer<enter><wait5>",
"/usr/bin/curl -O http://{{.HTTPIP}}:{{.HTTPPort}}/parallels-tools.sh<enter><wait5>",
"/usr/bin/bash ./install-parallels.sh<enter>"
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/install-base.sh<enter><wait5>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/poweroff.timer<enter><wait5>",
"/usr/bin/bash ./install-base.sh<enter>"
],
"disk_size": 20480,
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_timeout": "{{user `ssh_timeout`}}",
"shutdown_command": "sudo /parallels_tools.sh && sudo rm /parallels_tools.sh && sudo systemctl start poweroff.timer"
"ssh_timeout": "{{ user `ssh_timeout` }}",
"shutdown_command": "sudo systemctl start poweroff.timer"
}
],
"provisioners": [
{
"only": ["parallels-iso"],
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S bash '{{ .Path }}'",
"script": "scripts/install-parallels.sh"
},
{
"only": ["virtualbox-iso"],
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S bash '{{ .Path }}'",
"script": "scripts/install-virtualbox.sh"
}
],
"post-processors": [
{
"type": "vagrant",
"output": "output/packer_arch_{{.Provider}}.box"
"output": "output/packer_arch_{{ .Provider }}.box"
}
]
}
7 changes: 5 additions & 2 deletions srv/parallels-tools.sh → scripts/install-parallels.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Install parallels tools (https://wiki.archlinux.org/index.php/Parallels)
#!/usr/bin/bash -x

# Parallels Tools
# https://wiki.archlinux.org/index.php/Parallels
mount /dev/sr1 /mnt
ln -sf /usr/lib/systemd/scripts/ /etc/init.d
export def_sysconfdir=/etc/init.d
Expand All @@ -7,7 +10,7 @@ pacman -S --noconfirm python2 linux-headers
ln -sf /usr/bin/python2 /usr/local/bin/python
/mnt/install --install-unattended

# Cleanup after parallels tools installation
# clean up
umount /dev/sr1
/usr/bin/pacman -Rcns --noconfirm python2 linux-headers
rm -f /etc/init.d
Expand Down
16 changes: 16 additions & 0 deletions scripts/install-virtualbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/bash -x

# VirtualBox Guest Additions
# https://wiki.archlinux.org/index.php/VirtualBox
/usr/bin/pacman -S --noconfirm linux-headers virtualbox-guest-utils virtualbox-guest-dkms nfs-utils
echo -e 'vboxguest\nvboxsf\nvboxvideo' > /etc/modules-load.d/virtualbox.conf
guest_version=$(/usr/bin/pacman -Q virtualbox-guest-dkms | awk '{ print $2 }' | cut -d'-' -f1)
kernel_version="$(/usr/bin/pacman -Q linux | awk '{ print $2 }')-ARCH"
/usr/bin/dkms install "vboxguest/${guest_version}" -k "${kernel_version}/x86_64"
/usr/bin/systemctl enable dkms.service
/usr/bin/systemctl enable vboxservice.service
/usr/bin/systemctl enable rpcbind.service

# Add groups for VirtualBox folder sharing
/usr/bin/groupadd vagrant
/usr/bin/usermod --append --groups vagrant,vboxsf vagrant
File renamed without changes.
89 changes: 0 additions & 89 deletions srv/install-parallels.sh

This file was deleted.

97 changes: 0 additions & 97 deletions srv/install-virtualbox.sh

This file was deleted.