diff --git a/Makefile.cache b/Makefile.cache index b706214..4966907 100644 --- a/Makefile.cache +++ b/Makefile.cache @@ -1,23 +1,28 @@ CURL=curl -L all: \ - cache/nix-2.0.2-x86_64-linux.tar.bz2 \ - cache/jdk-8u144-linux-x64.rpm \ + cache/nix-2.1.1-x86_64-linux.tar.bz2 \ + cache/jdk-8u172-linux-x64.rpm \ cache/netbeans-8.2-javase-linux.sh \ - cache/ideaIC-2018.1.3.tar.gz + cache/ideaIC-2018.2.2.tar.gz \ + cache/CLion-2018.2.3.tar.gz -cache/nix-2.0.2-x86_64-linux.tar.bz2: | cache - ${CURL} https://nixos.org/releases/nix/nix-2.0.2/nix-2.0.2-x86_64-linux.tar.bz2 > $@ +cache/nix-2.1.1-x86_64-linux.tar.bz2: | cache + ${CURL} 'https://nixos.org/releases/nix/nix-2.1.1/nix-2.1.1-x86_64-linux.tar.bz2' > $@ -cache/jdk-8u144-linux-x64.rpm: | cache - ${CURL} -H 'Cookie: oraclelicense=accept-securebackup-cookie' \ - http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm > $@ + +cache/jdk-8u172-linux-x64.rpm: | cache + ${CURL} -H "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \ + 'http://download.oracle.com/otn-pub/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/jdk-8u172-linux-x64.rpm' > $@ cache/netbeans-8.2-javase-linux.sh: | cache - ${CURL} http://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-linux.sh > $@ + ${CURL} 'http://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-linux.sh' > $@ + +cache/ideaIC-2018.2.2.tar.gz: | cache + ${CURL} 'https://download.jetbrains.com/idea/ideaIC-2018.2.2.tar.gz' > $@ -cache/ideaIC-2018.1.3.tar.gz: | cache - ${CURL} https://download.jetbrains.com/idea/ideaIC-2018.1.3.tar.gz > $@ +cache/CLion-2018.2.3.tar.gz: | cache + ${CURL} 'https://download.jetbrains.com/cpp/CLion-2018.2.3.tar.gz' > $@ cache: mkdir cache diff --git a/RPM-GPG-KEY-oracle-ol6 b/RPM-GPG-KEY-oracle-ol6 new file mode 100644 index 0000000..0da1c10 --- /dev/null +++ b/RPM-GPG-KEY-oracle-ol6 @@ -0,0 +1,19 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.5 (GNU/Linux) + +mQENBEwtJWoBCACpiY2rGA6T0ceBi92X88/QclytVBjtDRohOVzs3pmIPh3ULqsW +G323nmyKbKQBBSjh9OnuO9Y09VG8mzr/w9YV0Ix4cI9/HDTERZ2+TR5u+VNn5J5h +yvwQSN/FEK6oH2+mz7O0yUNleN7UltR4MOEkHIoAhIvv+1AQQKN3OM8oalz+3gv/ +zz9rAoQczQzT7QWOtBrsRMZgBrKXY/TpJrpVSO3Hx8CnbhKGtLxCCrxZ5v7hh1ht +3CRAr2+h5bDA9KP6vBZWKEs7NgcvtZFDY6EJc7AoApr3phX9hHE2+snTxe82DkFT +uA69C8wLyjPCoSy+tcaCqJKOZelNy9RN/WKRABEBAAG0RE9yYWNsZSBPU1MgZ3Jv +dXAgKE9wZW4gU291cmNlIFNvZnR3YXJlIGdyb3VwKSA8YnVpbGRAb3NzLm9yYWNs +ZS5jb20+iQE8BBMBAgAmBQJMLSVqAhsDBQkWjmoABgsJCAcDAgQVAggDBBYCAwEC +HgECF4AACgkQcvl7dOxVHwMiNAf/cD8R74fCBeQsAYid5slIz7CG8xEOBUTDNEJT +p/owtzr7m7Ydp1txNBOkVeVkUP8czX5EldcmoxA4kCCyHhnxmpJnOt52Fy5ZRnYh +Ll5gYdpJpXGVScB7fnlh3rJAaesSTacVFC5MKIYPZBiTo9soSXMLNcG8WqHPasdd +AblC4t5BTDNYlX1RiPeP6m5egHnnxyAXsis8fqIZY0RC9hERxWQ6hdDAX0tJXY8F +88HDUozvo8jqTlg/5GZcfqcbUjjMUJQ5cBtH3adCthMycdPpPXWJQBuzMIdFJ03u +YuQ3XrKxBkOLips+OZuWNVZzrPOHsenb49aX4yQsLVc2E2fhKQ== +=M8XY +-----END PGP PUBLIC KEY BLOCK----- diff --git a/c6x64/gui-dev-java.json b/c6x64/gui-dev-java.json index 8d6fa95..514b79b 100644 --- a/c6x64/gui-dev-java.json +++ b/c6x64/gui-dev-java.json @@ -2,41 +2,106 @@ "provisioners": [ { "type": "file", - "source": "cache/nix-2.0.2-x86_64-linux.tar.bz2", - "destination": "nix-2.0.2-x86_64-linux.tar.bz2" - }, - { + "source": "cache/{{user `NIX_FILENAME`}}", + "destination": "{{user `NIX_FILENAME`}}" + }, + { "type": "file", - "source": "cache/ideaIC-2018.1.3.tar.gz", - "destination": "ideaIC-2018.1.3.tar.gz" - }, - { + "source": "RPM-GPG-KEY-oracle-ol6", + "destination": "RPM-GPG-KEY-oracle-ol6" + }, + { + "type": "file", + "source": "cache/{{user `JDK_FILENAME`}}", + "destination": "{{user `JDK_FILENAME`}}" + }, + + { + "type": "file", + "source": "cache/{{ user `VMWARE_TOOLS_FILENAME` }}", + "destination": "{{ user `VMWARE_TOOLS_FILENAME` }}" + }, + + { + "type": "file", + "source": "cache/{{ user `INTELLIJ_FILENAME` }}", + "destination": "{{ user `INTELLIJ_FILENAME` }}" + }, + + { "type": "file", - "source": "cache/jdk-8u144-linux-x64.rpm", - "destination": "jdk-8u144-linux-x64.rpm" + "source": "cache/{{ user `CLION_FILENAME` }}", + "destination": "{{ user `CLION_FILENAME` }}" }, - { + + { + "type": "shell-local", + "command": "chmod 777 cache/{{ user `NETBEANS_FILENAME` }}" + }, + { "type": "file", - "source": "cache/netbeans-8.2-javase-linux.sh", - "destination": "netbeans-8.2-javase-linux.sh" + "source": "cache/{{ user `NETBEANS_FILENAME` }}", + "destination": "{{ user `NETBEANS_FILENAME` }}" }, { + "type": "shell-local", + "command": "patch scripts/install-nix-2.1.1 < scripts/nixpatch" + }, + { "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", "scripts": [ - "scripts/nix.sh", - "scripts/nix-chromium.sh", - "scripts/jdk.sh", - "scripts/netbeans.sh", - "scripts/intellij.sh", - "scripts/cleanup.sh" - ] - } - ], + "scripts/install-nix-2.1.1" + ] +}, +{ + "type": "shell-local", + "command": "patch -R scripts/install-nix-2.1.1 < scripts/nixpatch" +}, +{ + "type": "shell", + "environment_vars": [ "JDK_FILENAME={{user `JDK_FILENAME`}}" ], + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/install_jdk.sh" + ] +}, +{ + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/install_vmtools.sh" + ] +}, +{ + "type": "shell", + "environment_vars": [ "INTELLIJ_FILENAME={{ user `INTELLIJ_FILENAME` }}" ], + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/install_intellij.sh" + ] +}, +{ + "type": "shell", + "environment_vars": [ "CLION_FILENAME={{ user `CLION_FILENAME` }}" ], + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/install_clion.sh" + ] +}, +{ + "type": "shell", + "environment_vars": [ "NETBEANS_FILENAME={{ user `NETBEANS_FILENAME` }}" ], + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/install_netbeans.sh" + ] +} +], "builders": [ { "type": "virtualbox-ovf", - "source_path": "build/c6x64-gui.ova", + "source_path": "c6x64-gui.ova", "output_directory": "build/out", "vm_name": "c6x64-gui-dev-java", "boot_wait": "5s", @@ -47,15 +112,15 @@ "ssh_password": "vagrant", "ssh_port": 22, "ssh_wait_timeout": "10000s", - "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh", - "vboxmanage": [ - [ - "modifyvm", - "{{.Name}}", - "--memory", - "1024" - ] - ] + "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh" } - ] +], + +"post-processors": [ + { + "type": "shell-local", + "command": "mv build/out/c6x64-gui-dev-java.ova . ; rm -rf build/*" + } +] + } diff --git a/c6x64/gui.json b/c6x64/gui.json index 7c42bbd..f7d6a3c 100644 --- a/c6x64/gui.json +++ b/c6x64/gui.json @@ -12,7 +12,7 @@ "builders": [ { "type": "virtualbox-ovf", - "source_path": "build/c6x64-kernel-ml-epel.ova", + "source_path": "c6x64-kernel-ml-epel.ova", "output_directory": "build/out", "vm_name": "c6x64-gui", "boot_wait": "5s", @@ -23,15 +23,13 @@ "ssh_password": "vagrant", "ssh_port": 22, "ssh_wait_timeout": "10000s", - "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh", - "vboxmanage": [ - [ - "modifyvm", - "{{.Name}}", - "--memory", - "1024" - ] - ] + "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh" + } - ] +], + +"post-processors": [{ + "type": "shell-local", + "command": "mv build/out/c6x64-gui.ova . ; rm -rf build/*" + }] } diff --git a/c6x64/kernel-ml-epel.json b/c6x64/kernel-ml-epel.json index 4061336..784c66f 100644 --- a/c6x64/kernel-ml-epel.json +++ b/c6x64/kernel-ml-epel.json @@ -7,6 +7,7 @@ "scripts": [ "scripts/elrepo-kernel-ml.sh", "scripts/epel.sh", + "scripts/install_ansible.sh", "scripts/cleanup.sh" ] } @@ -14,7 +15,7 @@ "builders": [ { "type": "virtualbox-ovf", - "source_path": "build/c6x64-minimal.ova", + "source_path": "c6x64-minimal.ova", "output_directory": "build/out", "vm_name": "c6x64-kernel-ml-epel", "boot_wait": "5s", @@ -26,14 +27,11 @@ "ssh_port": 22, "ssh_wait_timeout": "10000s", "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh", - "vboxmanage": [ - [ - "modifyvm", - "{{.Name}}", - "--memory", - "1024" - ] - ] + "post_shutdown_delay" : "2m" } - ] +], +"post-processors": [{ + "type": "shell-local", + "command": "mv build/out/c6x64-kernel-ml-epel.ova . ; rm -rf build/*" + }] } diff --git a/c6x64/minimal.json b/c6x64/minimal.json index eaab66f..444f0a2 100644 --- a/c6x64/minimal.json +++ b/c6x64/minimal.json @@ -4,9 +4,12 @@ "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "scripts": [ + "scripts/install_svn.sh", + "scripts/install_git.sh", "scripts/cleanup.sh" ] - } + } + ], "builders": [ { @@ -17,27 +20,29 @@ " text selinux=0 ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6.ks" ], "boot_wait": "5s", - "disk_size": 409600, + "disk_size": 307200, "format": "ova", "guest_additions_mode": "disable", "guest_os_type": "RedHat_64", "http_directory": "http", - "iso_url": "http://mirrors.kernel.org/centos/6/isos/x86_64/CentOS-6.9-x86_64-minimal.iso", - "iso_checksum_type": "sha256", - "iso_checksum": "422af57b493b8af49d485885a730c5a1d955f803fac85aa51311c393168b9080", + "iso_url": "https://mirrors.edge.kernel.org/centos/6/isos/x86_64/CentOS-6.10-x86_64-minimal.iso", + "iso_checksum_type": "sha1", + "iso_checksum": "9cecc12a66c4f9a4225d18fe0aaab412ba367549", "ssh_username": "vagrant", "ssh_password": "vagrant", "ssh_port": 22, "ssh_wait_timeout": "10000s", "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh", + "post_shutdown_delay" : "2m", "vboxmanage": [ - [ - "modifyvm", - "{{.Name}}", - "--memory", - "1024" - ] + ["modifyvm", "{{.Name}}", "--memory","8192"], + ["modifyvm", "{{.Name}}", "--cpus", "3"] ] } - ] +], + +"post-processors": [{ + "type": "shell-local", + "command": "mv build/out/c6x64-minimal.ova . ; rm -rf build/*" + }] } diff --git a/c6x64/minimal_vmware.json b/c6x64/minimal_vmware.json new file mode 100644 index 0000000..e118b5a --- /dev/null +++ b/c6x64/minimal_vmware.json @@ -0,0 +1,38 @@ +{ + "provisioners": [ + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/cleanup.sh" + ] + } + ], + "builders": [ + { + "type": "vmware-iso", + "output_directory": "build/out", + "vm_name": "c6x64-minimal", + "boot_command": [ + " text selinux=0 ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6.ks" + ], + "boot_wait": "5s", + "disk_size": 10240, + "format": "ova", + "guest_os_type": "RedHat_64", + "http_directory": "http", + "iso_url": "https://mirrors.edge.kernel.org/centos/6/isos/x86_64/CentOS-6.10-x86_64-minimal.iso", + "iso_checksum_type": "sha1", + "iso_checksum": "9cecc12a66c4f9a4225d18fe0aaab412ba367549", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh", + "vmx_data": { + "memsize": "8192", + "numvcpus": "3" + } + } + ] +} diff --git a/c6x64/newuser.json b/c6x64/newuser.json new file mode 100644 index 0000000..c4b9a25 --- /dev/null +++ b/c6x64/newuser.json @@ -0,0 +1,15 @@ +{ + "NEWUSERLOGIN": "flast", + "NEWUSERFULLNAME": "First Last", + "AWS_ACCESS_KEY_ID": "AWS_ACCESS_KEY_ID", + "AWS_SECRET_ACCESS_KEY": "AWS_SECRET_ACCESS_KEY", + "AZURE_SECRET" : "AZURE_SECRET\\nAZURE_SECRET2\\nAZURE_SECRET3", + "SVN_SERVER_URL": "svn.int.snowflakecomputing.com", + "JDK_FILENAME": "jdk-8u172-linux-x64.rpm", + "INTELLIJ_FILENAME": "ideaIC-2018.2.2.tar.gz", + "CLION_FILENAME": "CLion-2018.2.3.tar.gz", + "NETBEANS_FILENAME": "netbeans-8.2-javase-linux.sh", + "VMWARE_TOOLS_FILENAME": "VMwareTools-10.0.6-3595377.tar.gz", + "NIX_FILENAME": "nix-2.1.1-x86_64-linux.tar.bz2" + +} diff --git a/c6x64/null.json b/c6x64/null.json new file mode 100644 index 0000000..828639f --- /dev/null +++ b/c6x64/null.json @@ -0,0 +1,36 @@ +{ + + "provisioners": [ + { + "type": "shell", + "environment_vars": ["NEWUSERLOGIN={{ user `NEWUSERLOGIN` }}", + "NEWUSERFULLNAME={{ user `NEWUSERFULLNAME` }}", + "AWS_ACCESS_KEY_ID={{ user `AWS_ACCESS_KEY_ID`}}", + "AWS_SECRET_ACCESS_KEY={{user `AWS_SECRET_ACCESS_KEY`}}", + "AZURE_SECRET={{user `AZURE_SECRET`}}", + "SVN_SERVER_URL={{user `SVN_SERVER_URL`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "scripts/createuser.sh" + ] + }, + { + "type": "file", + "source": "cache/nix-2.0.2-x86_64-linux.tar.bz2", + "destination": "nix-2.0.2-x86_64-linux.tar.bz2" + } + ], + + "builders": [ + { + "type": "null", + "communicator": "ssh", + "ssh_timeout": "5s", + "ssh_host": "192.168.9.13", + "ssh_username": "{{ user `NEWUSERLOGIN` }}", + "ssh_port": 22, + "ssh_password": "vagrant" + } + ] +} diff --git a/c6x64/renametonewuser.json b/c6x64/renametonewuser.json new file mode 100644 index 0000000..99e66c6 --- /dev/null +++ b/c6x64/renametonewuser.json @@ -0,0 +1,40 @@ +{ + "provisioners": [ + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "environment_vars": ["NEWUSERLOGIN={{ user `NEWUSERLOGIN` }}", + "NEWUSERFULLNAME={{ user `NEWUSERFULLNAME` }}", + "INTELLIJ_FILENAME={{ user `INTELLIJ_FILENAME` }}" + ], + "scripts": [ + "scripts/rename_user.sh" + ] + } + ], + "builders": [ + { + "type": "virtualbox-ovf", + "source_path": "c6x64-gui-dev-java.ova", + "output_directory": "build/out", + "vm_name": "c6x64-renameduser", + "boot_wait": "5s", + "format": "ova", + "guest_additions_mode": "disable", + "http_directory": "http", + "ssh_username": "root", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh" + + } +], + +"post-processors": [ + { + "type": "shell-local", + "command": "mv build/out/c6x64-renameduser.ova . ; rm -rf build/*" + } +] +} diff --git a/c6x64/setupuser.json b/c6x64/setupuser.json new file mode 100644 index 0000000..fd4e1a5 --- /dev/null +++ b/c6x64/setupuser.json @@ -0,0 +1,44 @@ +{ + "provisioners": [ + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "environment_vars": [ + "NEWUSERLOGIN={{ user `NEWUSERLOGIN` }}", + "NEWUSERFULLNAME={{ user `NEWUSERFULLNAME` }}", + "AWS_ACCESS_KEY_ID={{ user `AWS_ACCESS_KEY_ID` }}", + "AWS_SECRET_ACCESS_KEY={{user `AWS_SECRET_ACCESS_KEY` }}", + "AZURE_SECRET={{user `AZURE_SECRET` }}", + "SVN_SERVER_URL={{user `SVN_SERVER_URL` }}" + ], + "scripts": [ + "scripts/setup_newuser.sh" + ] + } + ], + "builders": [ + { + "type": "virtualbox-ovf", + "source_path": "c6x64-renameduser.ova", + "output_directory": "build/out", + "vm_name": "c6x64-newuser-final", + "boot_wait": "5s", + "format": "ova", + "guest_additions_mode": "disable", + "http_directory": "http", + "ssh_username": "{{ user `NEWUSERLOGIN` }}", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo 'rm -f /etc/ssh/ssh_host*; rm -f /tmp/shutdown.sh; /sbin/halt -h -p' > /tmp/shutdown.sh; sudo sh /tmp/shutdown.sh" + + } +], + +"post-processors": [ + { + "type": "shell-local", + "command": "mv build/out/c6x64-newuser-final.ova . ; rm -rf build/*" + } +] +} diff --git a/generic_build.sh b/generic_build.sh new file mode 100755 index 0000000..eb59175 --- /dev/null +++ b/generic_build.sh @@ -0,0 +1,12 @@ +#!/bin/bash -x + +time PACKER_LOG=1 packer build -on-error=ask -var-file=c6x64/newuser.json c6x64/minimal.json +[ "$?" -ne "0" ] && exit 1 +sleep 5 +time PACKER_LOG=1 packer build -on-error=ask -var-file=c6x64/newuser.json c6x64/kernel-ml-epel.json +[ "$?" -ne "0" ] && exit 1 +sleep 5 +time PACKER_LOG=1 packer build -on-error=ask -var-file=c6x64/newuser.json c6x64/gui.json +[ "$?" -ne "0" ] && exit 1 +sleep 5 +time PACKER_LOG=1 packer build -on-error=ask -var-file=c6x64/newuser.json c6x64/gui-dev-java.json diff --git a/http/centos6.ks b/http/centos6.ks index fdab22c..493617b 100644 --- a/http/centos6.ks +++ b/http/centos6.ks @@ -14,6 +14,7 @@ rootpw vagrant # user is given sudo in %post user --name=vagrant --password=vagrant + # US + UTC keyboard us lang en_US.UTF-8 @@ -46,9 +47,9 @@ selinux --disabled zerombr # Really disable selinux bootloader --location=mbr --append="selinux=0" + # Create a single ext4 partition covering the entire disk clearpart --all - # part / --fstype=ext4 --grow --asprimary --size=1 part /boot --fstype ext4 --size=1024 @@ -79,6 +80,7 @@ chvt 3 yum -y update # Install man pages yum -y install yum-utils man man-pages +yum -y install xorg-x11-drv-vmware # Disable graphical boot sed -i '/^splashimage/d' /boot/grub/grub.conf diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 057578d..1d2025b 100644 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -7,7 +7,7 @@ package-cleanup --oldkernels --count=1 -y yum -y clean all # Remove hardware specific udev rules so hardware is properly initialized when -# being instanciated on new hardware. Without this networking can fail to come +# being instantiated on new hardware. Without this networking can fail to come # up as the eth0 MAC address should have changed. rm -f /etc/udev/rules.d/70-*.rules # Remove other references to hardware specific things with repsect to networking diff --git a/scripts/install-nix-2.1.1 b/scripts/install-nix-2.1.1 new file mode 100644 index 0000000..7adea1c --- /dev/null +++ b/scripts/install-nix-2.1.1 @@ -0,0 +1,67 @@ +#!/bin/sh + +# This script installs the Nix package manager on your system by +# downloading a binary distribution and running its installer script +# (which in turn creates and populates /nix). + +{ # Prevent execution if this script was only partially downloaded +oops() { + echo "$0:" "$@" >&2 + exit 1 +} + +tmpDir="$(mktemp -d -t nix-binary-tarball-unpack.XXXXXXXXXX || \ + oops "Can\'t create temporary directory for downloading the Nix binary tarball")" +cleanup() { + rm -rf "$tmpDir" +} +trap cleanup EXIT INT QUIT TERM + +require_util() { + type "$1" > /dev/null 2>&1 || which "$1" > /dev/null 2>&1 || + oops "you do not have '$1' installed, which I need to $2" +} + +case "$(uname -s).$(uname -m)" in + Linux.x86_64) system=x86_64-linux; hash=ad10b4da69035a585fe89d7330037c4a5d867a372bb0e52a1542ab95aec67999;; + Linux.i?86) system=i686-linux; hash=14b3b0c34971fb29f279164de83cae323ad443eb62529c368be38d5376bcb306;; + Linux.aarch64) system=aarch64-linux; hash=96c37fcb852d1bea19df29d49268d2b2878a73fef8f61801eec1434b7adc8d5a;; + Darwin.x86_64) system=x86_64-darwin; hash=938b2ab25fa344491eae51d8db7712028cc393b36a12250af7c5e87849631e0d;; + *) oops "sorry, there is no binary distribution of Nix for your platform";; +esac + +url="https://nixos.org/releases/nix/nix-2.1.1/nix-2.1.1-$system.tar.bz2" + +tarball="$tmpDir/$(basename "$tmpDir/nix-2.1.1-$system.tar.bz2")" + +require_util curl "download the binary tarball" +require_util bzcat "decompress the binary tarball" +require_util tar "unpack the binary tarball" + +echo "downloading Nix 2.1.1 binary tarball for $system from '$url' to '$tmpDir'..." +curl -L "$url" -o "$tarball" || oops "failed to download '$url'" + +if type sha256sum > /dev/null 2>&1; then + hash2="$(sha256sum -b "$tarball" | cut -c1-64)" +elif type shasum > /dev/null 2>&1; then + hash2="$(shasum -a 256 -b "$tarball" | cut -c1-64)" +elif type openssl > /dev/null 2>&1; then + hash2="$(openssl dgst -r -sha256 "$tarball" | cut -c1-64)" +else + oops "cannot verify the SHA-256 hash of '$url'; you need one of 'shasum', 'sha256sum', or 'openssl'" +fi + +if [ "$hash" != "$hash2" ]; then + oops "SHA-256 hash mismatch in '$url'; expected $hash, got $hash2" +fi + +unpack=$tmpDir/unpack +mkdir -p "$unpack" +< "$tarball" bzcat | tar -xf - -C "$unpack" || oops "failed to unpack '$url'" + +script=$(echo "$unpack"/*/install) + +[ -e "$script" ] || oops "installation script is missing from the binary tarball!" +"$script" "$@" + +} # End of wrapping diff --git a/scripts/install_ansible.sh b/scripts/install_ansible.sh new file mode 100644 index 0000000..f8f2d54 --- /dev/null +++ b/scripts/install_ansible.sh @@ -0,0 +1,3 @@ +#!/bin/bash -x + +yum -y install ansible diff --git a/scripts/install_clion.sh b/scripts/install_clion.sh new file mode 100644 index 0000000..ba94542 --- /dev/null +++ b/scripts/install_clion.sh @@ -0,0 +1,16 @@ +#!/bin/bash -x + +set -o errexit +set -o nounset +set -o pipefail + +[ -f "/home/vagrant/${CLION_FILENAME}" ] + +EXTRACTDIR="clion-2018.2.3" + +tar -zxf "/home/vagrant/${CLION_FILENAME}" + +[ -f "/home/vagrant/${EXTRACTDIR}/bin/clion.sh" ] + +# Desktop is not created until after graphical login +ln -s "/home/vagrant/${EXTRACTDIR}/bin/clion.sh" "/home/vagrant/CLion_launcher" diff --git a/scripts/install_git.sh b/scripts/install_git.sh new file mode 100644 index 0000000..47ed1f1 --- /dev/null +++ b/scripts/install_git.sh @@ -0,0 +1,12 @@ +#!/bin/bash -x + +cat < /etc/yum.repos.d/WANdisco-git.repo +[WANdisco-git] +name=WANdisco Distribution of git +baseurl=http://opensource.wandisco.com/rhel/\$releasever/git/\$basearch +enabled=1 +gpgcheck=1 +gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco +WANdisco-git + +yum -y install git diff --git a/scripts/install_intellij.sh b/scripts/install_intellij.sh new file mode 100644 index 0000000..718cfe3 --- /dev/null +++ b/scripts/install_intellij.sh @@ -0,0 +1,16 @@ +#!/bin/bash -x + +set -o errexit +set -o nounset +set -o pipefail + +[ -f "/home/vagrant/${INTELLIJ_FILENAME}" ] + +EXTRACTDIR="$(dirname $(tar -ztf "${INTELLIJ_FILENAME}" | head -n1))" + +tar -zxf "/home/vagrant/${INTELLIJ_FILENAME}" + +[ -f "/home/vagrant/${EXTRACTDIR}/bin/idea.sh" ] + +# Desktop is not created until after graphical login +ln -s "/home/vagrant/${EXTRACTDIR}/bin/idea.sh" "/home/vagrant/IntelliJ_launcher" diff --git a/scripts/install_jdk.sh b/scripts/install_jdk.sh new file mode 100644 index 0000000..9140c1b --- /dev/null +++ b/scripts/install_jdk.sh @@ -0,0 +1,14 @@ +#!/bin/bash -x + + +set -o errexit +set -o nounset +set -o pipefail + +# RPM GPG keys can be downloaded from http://yum.oracle.com/RPM-GPG-KEY-oracle-ol6 +# see https://yum.oracle.com/faq.html +[ -f /home/vagrant/RPM-GPG-KEY-oracle-ol6 ] +sudo rpm --import /home/vagrant/RPM-GPG-KEY-oracle-ol6 +rpm -qp "/home/vagrant/${JDK_FILENAME}" -K +sudo yum -y remove 'java-*-openj*' || /bin/true +sudo yum -y install "${JDK_FILENAME}" diff --git a/scripts/install_netbeans.sh b/scripts/install_netbeans.sh new file mode 100644 index 0000000..df6a64b --- /dev/null +++ b/scripts/install_netbeans.sh @@ -0,0 +1,18 @@ +#!/bin/bash -x + +set -o errexit +set -o nounset +set -o pipefail + + + +[ -f "/home/vagrant/${NETBEANS_FILENAME}" ] + +/home/vagrant/${NETBEANS_FILENAME} --silent + +[ -f "/home/vagrant/netbeans-8.2/etc/netbeans.conf" ] + +sed -i 's|^netbeans_jdkhome=.*|netbeans_jdkhome="/usr/java/latest"|' "/home/vagrant/netbeans-8.2/etc/netbeans.conf" + +# Desktop is not created until after graphical login +ln -s "/home/vagrant/netbeans-8.2/bin/netbeans" "/home/vagrant/netbeans8.2_launcher" diff --git a/scripts/install_svn.sh b/scripts/install_svn.sh new file mode 100644 index 0000000..f66961f --- /dev/null +++ b/scripts/install_svn.sh @@ -0,0 +1,12 @@ +#!/bin/bash -x + +cat < /etc/yum.repos.d/WANdisco-svn1.9.repo +[WANdisco-svn19] +name=WANdisco SVN Repo 1.9 - \$basearch +enabled=1 +baseurl=http://opensource.wandisco.com/rhel/6/svn-1.9/RPMS/\$basearch/ +gpgcheck=1 +gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco +WANdisco-svn1.9 + +yum -y install subversion.x86_64 subversion-perl subversion-python subversion-tools diff --git a/scripts/install_vmtools.sh b/scripts/install_vmtools.sh new file mode 100644 index 0000000..c35b7d3 --- /dev/null +++ b/scripts/install_vmtools.sh @@ -0,0 +1,11 @@ +#!/bin/bash -x + +set -o errexit +set -o nounset +set -o pipefail + +tar -xzvf /home/vagrant/VMwareTools-10.0.6-3595377.tar.gz +sync +sleep 5 +sync +/home/vagrant/vmware-tools-distrib/vmware-install.pl -d diff --git a/scripts/intellij.sh b/scripts/intellij.sh deleted file mode 100644 index 8c5a81f..0000000 --- a/scripts/intellij.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -x - -set -o errexit -set -o nounset -set -o pipefail - -# The intention of this block is to recursively call this script without root -# permissions if invoked with sudo. If invoked as root without sudo, bail out. -if [ ${EUID} -eq 0 ]; then - # Running with root perms. Because of sudo? - if [ -z "${SUDO_USER:-}" ]; then - # script executed without sudo - echo "This script is not meant to run as root" >&2 - exit 1 - else - # script executed with sudo. recurse as the user that invoked this script - # so long as that user was not root. - SUDO_UID="$(id -u "${SUDO_USER}")" - if [ ${SUDO_UID} -eq 0 ]; then - echo "This script is not meant to run as root" >&2 - exit 1 - else - sudo -u "${SUDO_USER}" -i "${0}" ${@} - exit 0 - fi - fi -fi - -cd "${HOME}" - -INTELLIJ_URL="https://download.jetbrains.com/idea/ideaIC-2018.1.3.tar.gz" -INTELLIJ_FILENAME="$(basename "${INTELLIJ_URL}")" -#INTELLIJ_SHA256='9e3e0f4538707da37237106697fff4e0b5ed651085f456671764e1fbc9651bbe' - -#curl -L "${INTELLIJ_URL}" > "${INTELLIJ_FILENAME}" -[ -f "${INTELLIJ_FILENAME}" ] -#echo "${INTELLIJ_SHA256} ${INTELLIJ_FILENAME}" | sha256sum -c -EXTRACTDIR="$(dirname $(tar -ztf "${INTELLIJ_FILENAME}" | head -n1))" -tar -zxf "${INTELLIJ_FILENAME}" -[ -f "${HOME}/${EXTRACTDIR}/bin/idea.sh" ] -ln -s "${HOME}/${EXTRACTDIR}/bin/idea.sh" "${HOME}/Desktop/IntelliJ" diff --git a/scripts/jdk.sh b/scripts/jdk.sh deleted file mode 100644 index 01cb1f1..0000000 --- a/scripts/jdk.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -x - -set -o errexit -set -o nounset -set -o pipefail - -# The intention of this block is to recursively call this script without root -# permissions if invoked with sudo. If invoked as root without sudo, bail out. -if [ ${EUID} -eq 0 ]; then - # Running with root perms. Because of sudo? - if [ -z "${SUDO_USER:-}" ]; then - # script executed without sudo - echo "This script is not meant to run as root" >&2 - exit 1 - else - # script executed with sudo. recurse as the user that invoked this script - # so long as that user was not root. - SUDO_UID="$(id -u "${SUDO_USER}")" - if [ ${SUDO_UID} -eq 0 ]; then - echo "This script is not meant to run as root" >&2 - exit 1 - else - sudo -u "${SUDO_USER}" -i "${0}" ${@} - exit 0 - fi - fi -fi - -cd "${HOME}" - -#URL="http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm" -#URL="http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.rpm" -#URL="http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.rpm" -#URL="http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.rpm" -URL="http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm" -FILENAME="$(basename "${URL}")" -[ -f "${FILENAME}" ] -#curl -f -L -H 'Cookie: oraclelicense=accept-securebackup-cookie' "${URL}" > "${FILENAME}" -rpm -qp "${FILENAME}" -K -sudo yum -y remove 'java-*-openj*' || /bin/true -sudo yum -y install "${FILENAME}" diff --git a/scripts/netbeans.sh b/scripts/netbeans.sh deleted file mode 100644 index ca65756..0000000 --- a/scripts/netbeans.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -x - -set -o errexit -set -o nounset -set -o pipefail - -# The intention of this block is to recursively call this script without root -# permissions if invoked with sudo. If invoked as root without sudo, bail out. -if [ ${EUID} -eq 0 ]; then - # Running with root perms. Because of sudo? - if [ -z "${SUDO_USER:-}" ]; then - # script executed without sudo - echo "This script is not meant to run as root" >&2 - exit 1 - else - # script executed with sudo. recurse as the user that invoked this script - # so long as that user was not root. - SUDO_UID="$(id -u "${SUDO_USER}")" - if [ ${SUDO_UID} -eq 0 ]; then - echo "This script is not meant to run as root" >&2 - exit 1 - else - sudo -u "${SUDO_USER}" -i "${0}" ${@} - exit 0 - fi - fi -fi - -cd "${HOME}" - -NETBEANS_URL="http://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-linux.sh" -NETBEANS_FILENAME="$(basename "${NETBEANS_URL}")" -NETBEANS_MD5="dfa4af8f4a1fe88e3f8dea6b646882a7" - -#curl -f -L "${NETBEANS_URL}" > "${NETBEANS_FILENAME}" -[ -f "${NETBEANS_FILENAME}" ] -#echo "${NETBEANS_MD5} ${NETBEANS_FILENAME}" | md5sum -c -which java &>/dev/null -sh netbeans-8.2-javase-linux.sh --silent -[ -f "${HOME}/netbeans-8.2/etc/netbeans.conf" ] -sed -i 's|^netbeans_jdkhome=.*|netbeans_jdkhome="/usr/java/latest"|' "${HOME}/netbeans-8.2/etc/netbeans.conf" diff --git a/scripts/nix-chromium.sh b/scripts/nix-chromium.sh deleted file mode 100644 index 7cb6d37..0000000 --- a/scripts/nix-chromium.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -x - -set -o errexit -set -o nounset -set -o pipefail - -# The intention of this block is to recursively call this script without root -# permissions if invoked with sudo. If invoked as root without sudo, bail out. -if [ ${EUID} -eq 0 ]; then - # Running with root perms. Because of sudo? - if [ -z "${SUDO_USER:-}" ]; then - # script executed without sudo - echo "This script is not meant to run as root" >&2 - exit 1 - else - # script executed with sudo. recurse as the user that invoked this script - # so long as that user was not root. - SUDO_UID="$(id -u "${SUDO_USER}")" - if [ ${SUDO_UID} -eq 0 ]; then - echo "This script is not meant to run as root" >&2 - exit 1 - else - sudo -u "${SUDO_USER}" -i "${0}" ${@} - exit 0 - fi - fi -fi - -which nix-env &> /dev/null -nix-env -i chromium - -# ${HOME}/.local/share/applications gets created on first graphical login. This -# doesn't happen during the build process so we have to create the directory. -umask 0022 -mkdir -p ${HOME}/.local/share/applications -DESKTOP_SHORTCUT="$(nix-env -q chromium --out-path | awk '{print $2}')/share/applications/chromium.desktop" -#[ -f "${DESKTOP_SHORTCUT}" ] && cp "${DESKTOP_SHORTCUT}" ${HOME}/.local/share/applications/ diff --git a/scripts/nix.sh b/scripts/nix.sh deleted file mode 100644 index 71732e0..0000000 --- a/scripts/nix.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -x - -set -o errexit -set -o nounset -set -o pipefail - -# The intention of this block is to recursively call this script without root -# permissions if invoked with sudo. If invoked as root without sudo, bail out. -if [ ${EUID} -eq 0 ]; then - # Running with root perms. Because of sudo? - if [ -z "${SUDO_USER:-}" ]; then - # script executed without sudo - echo "This script is not meant to run as root" >&2 - exit 1 - else - # script executed with sudo. recurse as the user that invoked this script - # so long as that user was not root. - SUDO_UID="$(id -u "${SUDO_USER}")" - if [ ${SUDO_UID} -eq 0 ]; then - echo "This script is not meant to run as root" >&2 - exit 1 - else - sudo -u "${SUDO_USER}" -i "${0}" ${@} - exit 0 - fi - fi -fi - -cd "${HOME}" -[ -w . ] - -curl https://nixos.org/nix/install > nix_installer -# nixos.org can get hella slow, use a cached copy -sed -i 's/^curl -L "$url" | bzcat/bzcat nix-2.0.2-x86_64-linux.tar.bz2/' nix_installer -sh nix_installer -rm -f nix_installer diff --git a/scripts/nixpatch b/scripts/nixpatch new file mode 100644 index 0000000..711616d --- /dev/null +++ b/scripts/nixpatch @@ -0,0 +1,27 @@ +33c33 +< url="https://nixos.org/releases/nix/nix-2.1.1/nix-2.1.1-$system.tar.bz2" +--- +> tarball="/home/vagrant/nix-2.1.1-$system.tar.bz2" +35,42c35 +< tarball="$tmpDir/$(basename "$tmpDir/nix-2.1.1-$system.tar.bz2")" +< +< require_util curl "download the binary tarball" +< require_util bzcat "decompress the binary tarball" +< require_util tar "unpack the binary tarball" +< +< echo "downloading Nix 2.1.1 binary tarball for $system from '$url' to '$tmpDir'..." +< curl -L "$url" -o "$tarball" || oops "failed to download '$url'" +--- +> echo "copying Nix 2.1.1 binary tarball for $system from $tarball to $tmpDir ..." +51c44 +< oops "cannot verify the SHA-256 hash of '$url'; you need one of 'shasum', 'sha256sum', or 'openssl'" +--- +> oops "cannot verify the SHA-256 hash of '$tarball'; you need one of 'shasum', 'sha256sum', or 'openssl'" +55c48 +< oops "SHA-256 hash mismatch in '$url'; expected $hash, got $hash2" +--- +> oops "SHA-256 hash mismatch in '$tarball'; expected $hash, got $hash2" +60c53 +< < "$tarball" bzcat | tar -xf - -C "$unpack" || oops "failed to unpack '$url'" +--- +> < "$tarball" bzcat | tar -xf - -C "$unpack" || oops "failed to unpack '$tarball'" diff --git a/scripts/rename_user.sh b/scripts/rename_user.sh new file mode 100644 index 0000000..40fb7a3 --- /dev/null +++ b/scripts/rename_user.sh @@ -0,0 +1,32 @@ +echo "Running: groupadd $NEWUSERLOGIN" +groupadd "$NEWUSERLOGIN" +echo "Done.." + +sleep 2 + +echo "Running: usermod -d /home/$NEWUSERLOGIN -m -l $NEWUSERLOGIN -g $NEWUSERLOGIN -c $NEWUSERFULLNAME vagrant" +usermod -d /home/"$NEWUSERLOGIN" -m -l "$NEWUSERLOGIN" -g "$NEWUSERLOGIN" -c "$NEWUSERFULLNAME" vagrant +echo "Done.." + +sleep 3 + +echo "Setting up passwordless sudo for $NEWUSERLOGIN" +echo "$NEWUSERLOGIN ALL=(ALL) NOPASSWD: ALL" | tee "/etc/sudoers.d/$NEWUSERLOGIN" &>/dev/null +echo "Done.." + +sleep 3 + +# fix symlink for IntelliJ +echo "Fixing Intellij launcher symlink" +EXTRACTDIR="$(dirname $(tar -ztf "/home/${NEWUSERLOGIN}/${INTELLIJ_FILENAME}" | head -n1))" +ln -sf "/home/${NEWUSERLOGIN}/${EXTRACTDIR}/bin/idea.sh" "/home/${NEWUSERLOGIN}/IntelliJ_launcher" +echo "Done" + +sleep 3 + +# fix symlink for netbeans +echo "Fixing Netbeans launcher symlink" +ln -sf "/home/${NEWUSERLOGIN}/netbeans-8.2/bin/netbeans" "/home/${NEWUSERLOGIN}/netbeans8.2_launcher" +echo "Done" + +echo "Renamed vagrant to $NEWUSERLOGIN" diff --git a/scripts/runovftool.sh b/scripts/runovftool.sh new file mode 100755 index 0000000..cf2abd7 --- /dev/null +++ b/scripts/runovftool.sh @@ -0,0 +1,76 @@ +#!/bin/bash -x + +declare -r VM_FILENAME="$1" + +if [ -d "/Applications/VMware Fusion.app/Contents/Library" ]; then + declare -r VMWARE_LIBDIR="/Applications/VMware Fusion.app/Contents/Library" +elif [ -d "/opt/homebrew-cask/Caskroom/vmware-fusion/8.1.0-3272237/VMware Fusion.app/Contents/Library/" ]; then + declare -r VMWARE_LIBDIR="/opt/homebrew-cask/Caskroom/vmware-fusion/8.1.0-3272237/VMware Fusion.app/Contents/Library/" +else + echo "Unable to find VMWare" >&2 + exit 1 +fi + +declare -r VMRUN="${VMWARE_LIBDIR}/vmrun" +declare -r OVFTOOL="${VMWARE_LIBDIR}/VMware OVF Tool/ovftool" + +declare -r VMWARE_VMDIR="${HOME}/Documents/VirtualMachines" +declare -r VM_DIR="${VMWARE_VMDIR}/${VM_FILENAME/%ova/vmwarevm}" +declare -r VMXFILE="${VM_DIR}/${VM_FILENAME/%ova/vmx}" + +function error() { + echo "[ERROR] ${@}" >&2 + exit 1 +} + +function info() { + echo "[INFO] ${@}" +} + +function verify_os() { + info "Verifying OS is Mac OS X" + [ "$(uname -s)" == "Darwin" ] || error "Only Mac OS X is supported" +} + +function verify_vmware() { + info "Verifying VMware Fusion 7 or 8 is properly installed" + [[ -d "${VMWARE_LIBDIR}" ]] || \ + error "VMware Fusion 7 or 8 must be installed" + [[ -x "${VMRUN}" ]] || \ + error "Cannot locate vmrun, check VMware Fusion installation" + [[ -x "${OVFTOOL}" ]] || \ + error "Cannot locate ovftool, check VMware Fusion installation" + mkdir -p "${VMWARE_VMDIR}" + [[ -d "${VMWARE_VMDIR}" ]] || \ + error "Unable to create directory for VMware VMs: ${VMWARE_VMDIR}" +} + + +function vmware_import() { + + [[ -f "$1" ]] || error "File $1 not found" + + info "Importing $1" + + mkdir -p "${VM_DIR}" + + [[ -f "${VMXFILE}" ]] && error "A VM appears to already exist at ${VM_DIR}. Delete or rename it if you want to continue." + + "${OVFTOOL}" --lax "$1" "${VMXFILE}" + perl -pi -e 's/^guestos =.*/guestos = "rhel6-64"/' "${VMXFILE}" + + # Configure Video, CPU, and time settings + cat >> "${VMXFILE}" << EOF +virtualHW.productCompatibility = "hosted" +mks.enable3d = "TRUE" +svga.graphicsMemoryKB = "786432" +vhv.enable = "TRUE" +vpmc.enable = "TRUE" +tools.syncTime = "TRUE" +svga.minVRAMSize = "67108864" +EOF + # Start the VM + info "Starting the VM" + "${VMRUN}" -T fusion start "${VMXFILE}" +} +vmware_import $1 diff --git a/scripts/setup_newuser.sh b/scripts/setup_newuser.sh new file mode 100644 index 0000000..a945fc1 --- /dev/null +++ b/scripts/setup_newuser.sh @@ -0,0 +1,39 @@ +#!/bin/bash -x + +echo "Doing echo $AWS_ACCESS_KEY_ID > /home/$NEWUSERLOGIN/.awssecret" +echo $AWS_ACCESS_KEY_ID > /home/$NEWUSERLOGIN/.awssecret +echo "Done.." + +echo "Doing $AWS_SECRET_ACCESS_KEY >> /home/$NEWUSERLOGIN/.awssecret" +echo $AWS_SECRET_ACCESS_KEY >> /home/$NEWUSERLOGIN/.awssecret # note >> for append +echo "Done.." + +echo "Doing echo -ne $AZURE_SECRET > /home/$NEWUSERLOGIN/.azuresecret" +echo -ne $AZURE_SECRET > /home/$NEWUSERLOGIN/.azuresecret +echo "Done.." + +echo "Doing chmod 600 /home/$NEWUSERLOGIN/.azuresecret" +chmod 600 /home/$NEWUSERLOGIN/.azuresecret +echo "Done.." + +echo "Doing rm -rf /home/$NEWUSERLOGIN/.ssh/*" +rm -rf /home/$NEWUSERLOGIN/.ssh/* +echo "Done.." + +echo "Creating ssh keys for $NEWUSERLOGIN" +ssh-keygen -f /home/$NEWUSERLOGIN/.ssh/id_rsa -N "" +echo "Done.." + +echo "Setting up ~/.ssh/config for $NEWUSERLOGIN" +echo -e "\nHost $SVN_SERVER_URL svn1 svn\n User=$NEWUSERLOGIN" >> /home/$NEWUSERLOGIN/.ssh/config +echo "Done.." + +echo "Doing chmod 600 /home/$NEWUSERLOGIN/.ssh/config" +chmod 600 /home/$NEWUSERLOGIN/.ssh/config +echo "Done.." + +echo "Set up Publickey based ssh login to self" +cat /home/$NEWUSERLOGIN/.ssh/id_rsa.pub >> /home/$NEWUSERLOGIN/.ssh/authorized_keys +echo "Done.." + +echo "User \"$NEWUSERLOGIN\" with full name \"$NEWUSERFULLNAME\" created successfully" diff --git a/scripts/sleep-debug.sh b/scripts/sleep-debug.sh deleted file mode 100644 index 1262e29..0000000 --- a/scripts/sleep-debug.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -x - -env -echo -set -sleep 3600 diff --git a/scripts/unsudo.sh b/scripts/unsudo.sh deleted file mode 100644 index 133ca1a..0000000 --- a/scripts/unsudo.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset -set -o pipefail - -# The intention of this block is to recursively call this script without root -# permissions if invoked with sudo. If invoked as root without sudo, bail out. -if [ ${EUID} -eq 0 ]; then - # Running with root perms. Because of sudo? - if [ -z "${SUDO_USER:-}" ]; then - # script executed without sudo - echo "This script is not meant to run as root" >&2 - exit 1 - else - # script executed with sudo. recurse as the user that invoked this script - # so long as that user was not root. - SUDO_UID="$(id -u "${SUDO_USER}")" - if [ ${SUDO_UID} -eq 0 ]; then - echo "This script is not meant to run as root" >&2 - exit 1 - else - sudo -u "${SUDO_USER}" -i "${0}" ${@} - exit 0 - fi - fi -fi - -echo "Do something" diff --git a/user_build.sh b/user_build.sh new file mode 100755 index 0000000..f2039db --- /dev/null +++ b/user_build.sh @@ -0,0 +1,8 @@ +#!/bin/bash -x + +time PACKER_LOG=1 packer build -on-error=ask -var-file=c6x64/newuser.json c6x64/renametonewuser.json + +[ "$?" -ne "0" ] && exit 1 + +sleep 5 +time PACKER_LOG=1 packer build -on-error=ask -var-file=c6x64/newuser.json c6x64/setupuser.json