From 634aae8d75bfd9231fa17e17246dc933f1d46d1a Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 6 Dec 2023 08:21:32 -0800 Subject: [PATCH] Do some better linting (#13) * Do some better linting * Update names, Packer version, and more * Do not lint on push * More linting and scripting * Cleanup shellcheck lint * Add Packer format check * Fix Packer formatting * Limit to only one * Remove generated HCL files * Only lint checked files * Use pipes instead * Improve attempt to build Actually go back to attempting to build boxes on GitHub. Maybe it will work better with this structure * Change to using environment files * Initialize plugins, first * More verbose usage of the file * Do the output properly this time * PACKER_LOG set to 1 * No need for python3 anymore * Limit to only one result * Choose a specific CPU model * Init separately * Update actions version * Add version outputting * Correct actions version * Try to execute qemu properly * Fix CPU model name * Do not over-subscribe GitHub runners * Try type instead of command to guard runs * Do not write to non-existent folder * Cache packer plugins * Use ~ instead of /home/greg * Try the proper path * Move to intelligent matrix * Set global env path * Add lots of waits for VBoxManage on hosted runners * Add more waits * Add more waits --- .github/actions/install_packer/action.yml | 4 +- .github/actions/setup/action.yaml | 33 ------ .github/workflows/build.yml | 99 ++++++++++++----- .github/workflows/test.yml | 61 ++++++---- .gitignore | 1 + attic/fedora-34-x86_64.pkrvars.hcl | 6 +- attic/fedora-35-x86_64.pkrvars.hcl | 6 +- attic/fedora-36-x86_64.pkrvars.hcl | 6 +- build.xsh | 9 +- distros/archlinux/rolling/amd64.pkrvars.hcl | 14 +-- distros/archlinux/rolling/finalize.sh | 2 +- distros/centos-stream/8/amd64.pkrvars.hcl | 12 -- distros/centos-stream/8/amd64.pkrvars.hcl.sh | 2 +- distros/centos-stream/8/virtualbox.sh | 4 +- distros/centos-stream/9/amd64.pkrvars.hcl | 12 -- distros/centos-stream/9/amd64.pkrvars.hcl.sh | 4 +- distros/centos-stream/9/virtualbox.sh | 4 +- distros/centos/7/amd64.pkrvars.hcl | 8 +- distros/centos/7/virtualbox.sh | 4 +- distros/debian/10/amd64.pkrvars.hcl | 20 ++-- distros/debian/10/virtualbox.sh | 6 +- distros/debian/11/amd64.pkrvars.hcl | 20 ++-- distros/debian/11/finalize.sh | 2 +- distros/debian/11/virtualbox.sh | 6 +- distros/debian/12/amd64.pkrvars.hcl | 20 ++-- distros/debian/12/finalize.sh | 2 +- distros/debian/12/virtualbox.sh | 6 +- distros/debian/9/amd64.pkrvars.hcl | 24 ++-- distros/debian/9/finalize.sh | 6 - distros/debian/9/virtualbox.sh | 6 +- distros/fedora/37/amd64.pkrvars.hcl | 8 +- distros/fedora/38/amd64.pkrvars.hcl | 12 +- distros/fedora/39/amd64.pkrvars.hcl | 12 +- distros/fedora/rawhide/amd64.pkrvars.hcl.sh | 8 +- distros/nixos/23.05/amd64.pkrvars.hcl.sh | 2 +- distros/nixos/23.11/amd64.pkrvars.hcl.sh | 2 +- distros/ubuntu/18.04/amd64.pkrvars.hcl | 28 ++--- distros/ubuntu/18.04/finalize.sh | 2 +- distros/ubuntu/20.04/amd64.pkrvars.hcl | 22 ++-- distros/ubuntu/20.04/finalize.sh | 2 +- distros/ubuntu/22.04/amd64.pkrvars.hcl | 24 ++-- distros/ubuntu/22.04/finalize.sh | 2 +- distros/ubuntu/23.10/amd64.pkrvars.hcl | 24 ++-- distros/ubuntu/23.10/finalize.sh | 2 +- lib/build.py | 22 +++- lib/provider.py | 8 ++ modify_timeout.sh | 4 +- scripts/minimize.sh | 10 +- scripts/vagrant.sh | 1 + sources/build.pkr.hcl | 100 ++++++++--------- sources/hyperv-iso.pkr.hcl | 44 ++++---- sources/inputs.pkr.hcl | 111 +++++++++++-------- sources/qemu.pkr.hcl | 70 ++++++------ sources/virtualbox-iso.pkr.hcl | 58 +++++----- sources/vmware-iso.pkr.hcl | 44 ++++---- 55 files changed, 536 insertions(+), 495 deletions(-) delete mode 100644 .github/actions/setup/action.yaml delete mode 100644 distros/centos-stream/8/amd64.pkrvars.hcl delete mode 100644 distros/centos-stream/9/amd64.pkrvars.hcl diff --git a/.github/actions/install_packer/action.yml b/.github/actions/install_packer/action.yml index f44d82a..b1f0493 100644 --- a/.github/actions/install_packer/action.yml +++ b/.github/actions/install_packer/action.yml @@ -5,7 +5,7 @@ inputs: version: description: Version of Packer to install required: true - default: "1.9.2" + default: "1.9.4" pup_version: description: Version of Pup to install required: true @@ -21,7 +21,7 @@ runs: # Install virtualbox sudo apt-get update # Install QEmu, etc - sudo apt-get install -y unzip python3-{virtualenv,yaml} cloud-utils xorriso qemu-system-{x86,ppc} vagrant + sudo apt-get install -y unzip cloud-utils xorriso qemu-system-{x86,ppc} vagrant # Install packer.io curl -O https://releases.hashicorp.com/packer/${{ inputs.version }}/packer_${{ inputs.version }}_linux_amd64.zip unzip -o packer_${{ inputs.version }}_linux_amd64.zip -d /usr/local/bin diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml deleted file mode 100644 index 0d4f6a2..0000000 --- a/.github/actions/setup/action.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Setup environment -description: Sets up some basic components of the environment -inputs: - ansible: - description: Install Ansible as well - required: false - default: false -runs: - using: composite - steps: - - name: Install Python 3 - uses: actions/setup-python@v3 - with: - python-version: "3" - - name: Setup pip cache - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - - name: Install Pip and tox - shell: bash - run: | - set -exo pipefail - python3 -m pip install -U pip - pip install -U wheel - pip install -U tox - - name: Install Ansible - if: inputs.ansible == 'true' - shell: bash - run: | - set -exo pipefail - pip install -U ansible - ansible-galaxy collection install -r ansible/requirements.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c01c17..4b048b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,72 +8,113 @@ name: Build the boxes - prereleased pull_request: +env: + PACKER_PLUGIN_PATH: "~/.config/packer/plugins" + jobs: collect: name: Discover distros - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: distros: ${{ steps.distros.outputs.distros }} build: ${{ steps.time.outputs.time }} steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install python + uses: actions/setup-python@v4 + with: + python-version: 3 + cache: pip + cache-dependency-path: .github/workflows/build.yml + - name: Discover boxes id: distros run: |- - set -eo pipefail - distros=$(ls distros/*.hcl{,.sh} | jq -cRs 'split("\n") | [ .[] | if length > 0 then . else empty end ]') - echo "::set-output name=distros::${distros}" + set -exo pipefail + pip install xonsh PyYAML + echo "distros=$(xonsh build.xsh -a --list)" >> "$GITHUB_OUTPUT" + - name: Find timestamp for versioning id: time - uses: nanzm/get-time-action@v1.1 + uses: nanzm/get-time-action@v2.0 with: format: 'YYYY.MM.DD.HH' build: name: Build box - runs-on: ${{ matrix.builder == 'virtualbox-iso.amd64' && 'macOS-12' || 'ubuntu-22.04' }} + runs-on: ${{ matrix.runner }} needs: - collect strategy: fail-fast: false - matrix: - builder: - - virtualbox-iso.amd64 - - qemu.amd64 - distro: ${{ fromJson( needs.collect.outputs.distros ) }} - needs_timeout: - - distros/ubuntu-20.04-x86_64.pkrvars.hcl + matrix: ${{ fromJson( needs.collect.outputs.distros ) }} steps: - name: Checkout project uses: actions/checkout@v3 - with: - submodules: recursive - - name: Setup system dependnecies - uses: ./.github/actions/setup - with: - ansible: true + - name: Install Packer and related tools uses: ./.github/actions/install_packer + - name: Clear disk space uses: greg-hellings/make-space@main - - name: Modify build timeouts, if necessary - if: contains(matrix.needs_timeout, matrix.distro) + + - name: Output tool versions shell: bash - run: ./modify_timeout.sh "${{ matrix.distro }}" + run: | + set -x + packer -version + if $(type qemu-system-x86_64); then + qemu-system-x86_64 -version + fi + if $(type VBoxManage); then + VBoxManage --version; + fi + - name: Run generator, if necessary - if: endsWith(matrix.distro, '.sh') - run: "${{ matrix.distro }}" + shell: bash + run: | + if [ -f "${{ matrix.distro }}.sh" ]; then + "./${{ matrix.distro }}.sh" + fi + + - name: Restore Packer plugin cache + uses: actions/cache/restore@v3 + id: cache-restore + with: + path: ~/.config/packer/plugins + key: ${{ runner.os }}-${{ hashFiles('sources/build.pkr.hcl') }} + + - name: Install Packer plugins + shell: bash + run: packer init sources + + - name: Cache Packer plugins + uses: actions/cache/save@v3 + if: always() + with: + path: ~/.config/packer/plugins + key: ${{ steps.cache-restore.outputs.cache-primary-key }} + - name: Build shell: bash run: | set -e - # Strip .sh if it is a dynamic one - file="$(printf "${{ matrix.distro }}" | sed -E -e 's/^(.*).sh$/\1/')" # Add a retry in case something bogus like a network failure happens - packer build -only="${{ matrix.builder }}" -var-file="${file}" -var "qemu_accelerator=tcg" -var "build=${{ needs.collect.outputs.build }}" ${{ github.event_name != 'release' && '-except=upload' || '' }} sources + packer build -only="${{ matrix.builder }}" \ + -var-file="${{ matrix.distro }}" \ + -var "qemu_accelerator=tcg" \ + -var "build=${{ needs.collect.outputs.build }}" \ + -var "cpu_model=Skylake-Client" \ + -var "cpus=2" \ + -var "memory=4096" \ + ${{ github.event_name != 'release' && '-except=upload' || '' }} \ + sources env: VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} - PACKER_LOG: ${{ contains(matrix.needs_timeout, matrix.distro) && '0' || '0' }} + PACKER_LOG: 1 #${{ contains(matrix.needs_timeout, matrix.distro) && '0' || '0' }} + - name: Upload artifact if: ${{ failure() }} uses: actions/upload-artifact@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f0d221..439b651 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,28 +1,42 @@ -name: Test the components of it +name: Lint and validation "on": - push: - paths-ignore: - - .github/workflow/build.yml - - http/** - - README.box.md - - README.md - - LICENSE pull_request: workflow_dispatch: jobs: validate: name: Validate Packer templates are reasonable - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup - - uses: ./.github/actions/install_packer - - name: Run syntax check + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Packer + uses: ./.github/actions/install_packer + + - name: Restore Packer plugin cache + uses: actions/cache/restore@v3 + id: cache-restore + with: + path: ~/.config/packer/plugins + key: ${{ runner.os }}-${{ hashFiles('sources/build.pkr.hcl') }} + + - name: Install Packer plugins + shell: bash + run: packer init sources + + - name: Cache Packer plugins + uses: actions/cache/save@v3 + if: always() + with: + path: ~/.config/packer/plugins + key: ${{ steps.cache-restore.outputs.cache-primary-key }} + + - name: Run validate check run: | set -exo pipefail - for vars in $(find distros/ -name '*.pkrvars.hcl'); do + for vars in $(find distros/ -name '*.pkrvars.hcl*'); do if [[ "${vars}" == *.sh ]]; then "./${vars}" vars=${vars%.sh} @@ -30,18 +44,17 @@ jobs: packer validate -except=upload -var-file=${vars} sources/ done + - name: Run Packer format check + run: git ls-files | grep -E -e '.hcl$' | xargs -L 1 packer fmt -check + lint: - name: Lint Ansible code - runs-on: ubuntu-22.04 + name: Lint shell code + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - - name: Setup test environment - uses: ./.github/actions/setup - with: - ansible: true - - name: Run lint + + - name: Install shellcheck run: | - yamllint -c ansible/yamllint.yml ansible .github distros - find distros/ -name user-data | xargs yamllint -c ansible/yamllint.yml - # TODO: Add ansible-lint run + shellcheck --version + shellcheck $(find . -name '*.sh') diff --git a/.gitignore b/.gitignore index ed5cb52..8ad5ffb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Vagrantfile # Generated distros distros/fedora/rawhide/*.hcl distros/nixos/**/*.hcl +distros/centos-stream/**/*.hcl __pycache__ *.pyc diff --git a/attic/fedora-34-x86_64.pkrvars.hcl b/attic/fedora-34-x86_64.pkrvars.hcl index 1e46212..42d8562 100644 --- a/attic/fedora-34-x86_64.pkrvars.hcl +++ b/attic/fedora-34-x86_64.pkrvars.hcl @@ -1,8 +1,8 @@ -distro = "fedora" +distro = "fedora" version = "34" iso = { - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/34/Server/x86_64/iso/Fedora-Server-netinst-x86_64-34-1.2.iso" - checksum = "e1a38b9faa62f793ad4561b308c31f32876cfaaee94457a7a9108aaddaeec406" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/34/Server/x86_64/iso/Fedora-Server-netinst-x86_64-34-1.2.iso" + checksum = "e1a38b9faa62f793ad4561b308c31f32876cfaaee94457a7a9108aaddaeec406" } boot_command = [ "", diff --git a/attic/fedora-35-x86_64.pkrvars.hcl b/attic/fedora-35-x86_64.pkrvars.hcl index b08e7c7..02c0191 100644 --- a/attic/fedora-35-x86_64.pkrvars.hcl +++ b/attic/fedora-35-x86_64.pkrvars.hcl @@ -1,8 +1,8 @@ -distro = "fedora" +distro = "fedora" version = "35" iso = { - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/iso/Fedora-Server-dvd-x86_64-35-1.2.iso" - checksum = "3fe521d6c7b12c167f3ac4adab14c1f344dd72136ba577aa2bcc4a67bcce2bc6" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/iso/Fedora-Server-dvd-x86_64-35-1.2.iso" + checksum = "3fe521d6c7b12c167f3ac4adab14c1f344dd72136ba577aa2bcc4a67bcce2bc6" } boot_command = [ "", diff --git a/attic/fedora-36-x86_64.pkrvars.hcl b/attic/fedora-36-x86_64.pkrvars.hcl index f48455f..65f17fc 100644 --- a/attic/fedora-36-x86_64.pkrvars.hcl +++ b/attic/fedora-36-x86_64.pkrvars.hcl @@ -1,8 +1,8 @@ -distro = "fedora" +distro = "fedora" version = "36" iso = { - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/36/Server/x86_64/iso/Fedora-Server-dvd-x86_64-36-1.5.iso" - checksum = "5edaf708a52687b09f9810c2b6d2a3432edac1b18f4d8c908c0da6bde0379148" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/36/Server/x86_64/iso/Fedora-Server-dvd-x86_64-36-1.5.iso" + checksum = "5edaf708a52687b09f9810c2b6d2a3432edac1b18f4d8c908c0da6bde0379148" } boot_command = [ "", diff --git a/build.xsh b/build.xsh index 54cc6a8..effd216 100755 --- a/build.xsh +++ b/build.xsh @@ -5,6 +5,7 @@ import sys sys.path.append(str(Path(__file__).parent / "lib")) from support import Support, BASE import time +import json source test.xsh @@ -25,6 +26,9 @@ parser.add_argument("--stamp", "-s", help="Time stamp for builds", default=STAMP args = parser.parse_args() +my_list = [] + + # Now provide menus if we don't have defaults def process_all(): if args.distro: @@ -55,7 +59,7 @@ def do_build(build): headless = "headless=false" if args.list: - print(f"Would build: {build.var_file}") + my_list.append(build) else: if args.upload: if "VAGRANT_CLOUD_TOKEN" not in ${...}: @@ -73,5 +77,8 @@ def do_build(build): if args.all or args.list or (args.distro and args.version and args.build): process_all() + if args.list: + my_list = [d.matrix for d in my_list if d.is_github] + print(json.dumps({"include": my_list})) else: print("Doing menu stuff") diff --git a/distros/archlinux/rolling/amd64.pkrvars.hcl b/distros/archlinux/rolling/amd64.pkrvars.hcl index b407265..bb47c09 100644 --- a/distros/archlinux/rolling/amd64.pkrvars.hcl +++ b/distros/archlinux/rolling/amd64.pkrvars.hcl @@ -1,15 +1,15 @@ -distro = "archlinux" +distro = "archlinux" version = "rolling" iso = { - url = "http://dfw.mirror.rackspace.com/archlinux/iso/2023.11.01/archlinux-2023.11.01-x86_64.iso" - checksum = "477f50617d648e46d6e326549aa56ab92115a29a97f2ca364e944cea06970608" + url = "http://dfw.mirror.rackspace.com/archlinux/iso/2023.11.01/archlinux-2023.11.01-x86_64.iso" + checksum = "477f50617d648e46d6e326549aa56ab92115a29a97f2ca364e944cea06970608" } boot_command = [ " net.ifnames=0 biosdevnames=0", - "", # Wait for system to come up? - "curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh", + "", # Wait for system to come up? + "curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh", "", - "/usr/bin/bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}" + "/usr/bin/bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}" ] http_directory = "distros/archlinux/rolling/http/" -boot_wait = "10s" +boot_wait = "10s" diff --git a/distros/archlinux/rolling/finalize.sh b/distros/archlinux/rolling/finalize.sh index 59d1850..ec3703e 100644 --- a/distros/archlinux/rolling/finalize.sh +++ b/distros/archlinux/rolling/finalize.sh @@ -3,7 +3,7 @@ set -ex pacman -Syyu --noconfirm -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/distros/centos-stream/8/amd64.pkrvars.hcl b/distros/centos-stream/8/amd64.pkrvars.hcl deleted file mode 100644 index 8aee72b..0000000 --- a/distros/centos-stream/8/amd64.pkrvars.hcl +++ /dev/null @@ -1,12 +0,0 @@ -distro = "centos-stream" -version = "8" -iso = { - url = "http://mirror.centos.org/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.iso" - checksum = "83fb6025b52ba893669575f7df0048b3adc8e66b4d7c19d8f5522651f19150ba" -} -boot_command = [ - "", - "inst.text inst.ks=cdrom:/ks.cfg console=tty0", - "" -] -cd_files = [ "distros/centos-stream/8/disc/*" ] diff --git a/distros/centos-stream/8/amd64.pkrvars.hcl.sh b/distros/centos-stream/8/amd64.pkrvars.hcl.sh index 7bb1511..8340723 100755 --- a/distros/centos-stream/8/amd64.pkrvars.hcl.sh +++ b/distros/centos-stream/8/amd64.pkrvars.hcl.sh @@ -9,7 +9,7 @@ checksums="$(mktemp)" until curl -f -L -o "${checksums}" "http://mirror.centos.org/centos/8-stream/isos/x86_64/CHECKSUM"; do sleep 1 done -sha="$(cat "${checksums}" | grep latest-boot | grep SHA256 | cut -d' ' -f 4)" +sha="$(grep -e latest-boot "${checksums}" | grep SHA256 | cut -d' ' -f 4)" cat << HERPDERP > "${name}" distro = "centos-stream" diff --git a/distros/centos-stream/8/virtualbox.sh b/distros/centos-stream/8/virtualbox.sh index 475b69d..7ea8069 100644 --- a/distros/centos-stream/8/virtualbox.sh +++ b/distros/centos-stream/8/virtualbox.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -ex -packages="gcc make bzip2 kernel-devel elfutils-libelf-devel" -dnf install -y ${packages} # Intentionally not quoted +packages=(gcc make bzip2 kernel-devel elfutils-libelf-devel) +dnf install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install --nox11 2>&1 | tee /root/vbox_addon_install.log umount /mnt diff --git a/distros/centos-stream/9/amd64.pkrvars.hcl b/distros/centos-stream/9/amd64.pkrvars.hcl deleted file mode 100644 index 8ee96d7..0000000 --- a/distros/centos-stream/9/amd64.pkrvars.hcl +++ /dev/null @@ -1,12 +0,0 @@ -distro = "centos-stream" -version = "9" -iso = { - url = "https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso" - checksum = "2553e0812dba592ae4f73a06105eec1a285623c9ae790a5674456eed1ce9dc4c" -} -boot_command = [ - "", - "inst.text inst.ks=cdrom:/ks.cfg console=tty0", - "" -] -cd_files = [ "distros/centos-stream/9/disc/*" ] diff --git a/distros/centos-stream/9/amd64.pkrvars.hcl.sh b/distros/centos-stream/9/amd64.pkrvars.hcl.sh index e6400f0..80d9c52 100755 --- a/distros/centos-stream/9/amd64.pkrvars.hcl.sh +++ b/distros/centos-stream/9/amd64.pkrvars.hcl.sh @@ -10,7 +10,7 @@ checksums="$(mktemp)" until curl -f -L -o "${checksums}" "${baseurl}.SHA256SUM"; do sleep 1 done -sha="$(cat "${checksums}" | awk '/SHA256/ {print $4}')" +sha="$(awk '/SHA256/ {print $4}' "${checksums}")" rm "${checksums}" cat << HERPDERP > "${name}" @@ -22,7 +22,7 @@ iso = { } boot_command = [ "", - "inst.text inst.ks=cdrom:/ks.cfg console=tty0", + "inst.text inst.ks=cdrom:/ks.cfg console=tty0", "" ] cd_files = [ "distros/centos-stream/9/disc/*" ] diff --git a/distros/centos-stream/9/virtualbox.sh b/distros/centos-stream/9/virtualbox.sh index 5848f07..c2e63bd 100644 --- a/distros/centos-stream/9/virtualbox.sh +++ b/distros/centos-stream/9/virtualbox.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -ex -packages="bzip2 kernel-devel kernel-headers make perl gcc" -dnf install -y ${packages} # Intentionally not quoted +packages=(bzip2 kernel-devel kernel-headers make perl gcc) +dnf install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install --nox11 2>&1 | tee /root/vbox_addon_install.log umount /mnt diff --git a/distros/centos/7/amd64.pkrvars.hcl b/distros/centos/7/amd64.pkrvars.hcl index 23f9e70..580f249 100644 --- a/distros/centos/7/amd64.pkrvars.hcl +++ b/distros/centos/7/amd64.pkrvars.hcl @@ -1,12 +1,12 @@ -distro = "centos" +distro = "centos" version = "7" iso = { - url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso" - checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6" + url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso" + checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6" } boot_command = [ "", " inst.ks=cdrom:/ks.cfg console=tty0", "" ] -cd_files = [ "distros/centos/7/disc/*" ] +cd_files = ["distros/centos/7/disc/*"] diff --git a/distros/centos/7/virtualbox.sh b/distros/centos/7/virtualbox.sh index 15a3560..bd5c2d0 100644 --- a/distros/centos/7/virtualbox.sh +++ b/distros/centos/7/virtualbox.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -ex -packages="bzip2 dkms kernel-devel kernel-headers make perl gcc" -yum install -y ${packages} # Intentionally not quoted +packages=(bzip2 dkms kernel-devel kernel-headers make perl gcc) +yum install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install 2>&1 | tee /root/vbox_addon_install.log umount /mnt diff --git a/distros/debian/10/amd64.pkrvars.hcl b/distros/debian/10/amd64.pkrvars.hcl index 58ae6cf..f2f6b47 100644 --- a/distros/debian/10/amd64.pkrvars.hcl +++ b/distros/debian/10/amd64.pkrvars.hcl @@ -1,16 +1,16 @@ -distro = "debian" +distro = "debian" version = "10" iso = { - url = "https://cdimage.debian.org/cdimage/archive/10.13.0/amd64/iso-cd/debian-10.13.0-amd64-netinst.iso" - checksum = "75aa64071060402a594dcf1e14afd669ca0f8bf757b56d4c9c1a31b8f7c8f931" + url = "https://cdimage.debian.org/cdimage/archive/10.13.0/amd64/iso-cd/debian-10.13.0-amd64-netinst.iso" + checksum = "75aa64071060402a594dcf1e14afd669ca0f8bf757b56d4c9c1a31b8f7c8f931" } boot_command = [ - "", - "auto ", - "DEBIAN_FRONTEND=text ", - "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", - "console=tty0 ", - "--- net.ifnames=0 biosdevnames=0 ", - "" + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", + "console=tty0 ", + "--- net.ifnames=0 biosdevnames=0 ", + "" ] http_directory = "distros/debian/10/http/" diff --git a/distros/debian/10/virtualbox.sh b/distros/debian/10/virtualbox.sh index c7ca72d..998449c 100644 --- a/distros/debian/10/virtualbox.sh +++ b/distros/debian/10/virtualbox.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash set -ex -packages="bzip2 dkms build-essential linux-headers-$(uname -r)" -apt install -y ${packages} # Intentionally not quoted +packages=(bzip2 dkms build-essential "linux-headers-$(uname -r)") +apt install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install 2>&1 | tee /root/vbox_addon_install.log -apt remove -y ${packages} # Also intentionally not quoted +apt remove -y "${packages[@]}" umount /mnt rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/debian/11/amd64.pkrvars.hcl b/distros/debian/11/amd64.pkrvars.hcl index fb6f665..0fbb210 100644 --- a/distros/debian/11/amd64.pkrvars.hcl +++ b/distros/debian/11/amd64.pkrvars.hcl @@ -1,16 +1,16 @@ -distro = "debian" +distro = "debian" version = "11" iso = { - url = "http://cdimage.debian.org/cdimage/archive/11.8.0/amd64/iso-cd/debian-11.8.0-amd64-netinst.iso" - checksum = "d7a74813a734083df30c8d35784926deaa36bc41e5c0766388e9f591ab056b72" + url = "http://cdimage.debian.org/cdimage/archive/11.8.0/amd64/iso-cd/debian-11.8.0-amd64-netinst.iso" + checksum = "d7a74813a734083df30c8d35784926deaa36bc41e5c0766388e9f591ab056b72" } boot_command = [ - "", - "auto ", - "DEBIAN_FRONTEND=text ", - "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", - "console=tty0 ", - "--- net.ifnames=0 biosdevnames=0 ", - "" + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", + "console=tty0 ", + "--- net.ifnames=0 biosdevnames=0 ", + "" ] http_directory = "distros/debian/11/http/" diff --git a/distros/debian/11/finalize.sh b/distros/debian/11/finalize.sh index 7104e91..cec7f5e 100644 --- a/distros/debian/11/finalize.sh +++ b/distros/debian/11/finalize.sh @@ -6,7 +6,7 @@ apt autoremove -y apt upgrade -y # Configure sshd to be faster -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/distros/debian/11/virtualbox.sh b/distros/debian/11/virtualbox.sh index c7ca72d..998449c 100644 --- a/distros/debian/11/virtualbox.sh +++ b/distros/debian/11/virtualbox.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash set -ex -packages="bzip2 dkms build-essential linux-headers-$(uname -r)" -apt install -y ${packages} # Intentionally not quoted +packages=(bzip2 dkms build-essential "linux-headers-$(uname -r)") +apt install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install 2>&1 | tee /root/vbox_addon_install.log -apt remove -y ${packages} # Also intentionally not quoted +apt remove -y "${packages[@]}" umount /mnt rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/debian/12/amd64.pkrvars.hcl b/distros/debian/12/amd64.pkrvars.hcl index 9a01911..b733ca0 100644 --- a/distros/debian/12/amd64.pkrvars.hcl +++ b/distros/debian/12/amd64.pkrvars.hcl @@ -1,16 +1,16 @@ -distro = "debian" +distro = "debian" version = "12" iso = { - url = "http://cdimage.debian.org/cdimage/release/12.2.0/amd64/iso-cd/debian-12.2.0-amd64-netinst.iso" - checksum = "23ab444503069d9ef681e3028016250289a33cc7bab079259b73100daee0af66" + url = "http://cdimage.debian.org/cdimage/release/12.2.0/amd64/iso-cd/debian-12.2.0-amd64-netinst.iso" + checksum = "23ab444503069d9ef681e3028016250289a33cc7bab079259b73100daee0af66" } boot_command = [ - "", - "auto ", - "DEBIAN_FRONTEND=text ", - "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", - "console=tty0 ", - "--- net.ifnames=0 biosdevnames=0 ", - "" + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", + "console=tty0 ", + "--- net.ifnames=0 biosdevnames=0 ", + "" ] http_directory = "distros/debian/12/http/" diff --git a/distros/debian/12/finalize.sh b/distros/debian/12/finalize.sh index 7104e91..cec7f5e 100644 --- a/distros/debian/12/finalize.sh +++ b/distros/debian/12/finalize.sh @@ -6,7 +6,7 @@ apt autoremove -y apt upgrade -y # Configure sshd to be faster -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/distros/debian/12/virtualbox.sh b/distros/debian/12/virtualbox.sh index c7ca72d..998449c 100644 --- a/distros/debian/12/virtualbox.sh +++ b/distros/debian/12/virtualbox.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash set -ex -packages="bzip2 dkms build-essential linux-headers-$(uname -r)" -apt install -y ${packages} # Intentionally not quoted +packages=(bzip2 dkms build-essential "linux-headers-$(uname -r)") +apt install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install 2>&1 | tee /root/vbox_addon_install.log -apt remove -y ${packages} # Also intentionally not quoted +apt remove -y "${packages[@]}" umount /mnt rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/debian/9/amd64.pkrvars.hcl b/distros/debian/9/amd64.pkrvars.hcl index 96907ba..8885bd8 100644 --- a/distros/debian/9/amd64.pkrvars.hcl +++ b/distros/debian/9/amd64.pkrvars.hcl @@ -1,18 +1,18 @@ -distro = "debian" +distro = "debian" version = "9" iso = { - url = "https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-netinst.iso" - checksum = "71c7e9eb292acc880f84605b1ca2b997f25737fe0a43fc9586f61d35cd2eb43b" + url = "https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-netinst.iso" + checksum = "71c7e9eb292acc880f84605b1ca2b997f25737fe0a43fc9586f61d35cd2eb43b" } boot_command = [ - "", - "auto ", - "DEBIAN_FRONTEND=text ", - "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", - "console=tty0 ", - "--- ", # Lines after this are copied to the resulting system?! - "biosdevnames=0 ", - "net.ifnames=0 ", - "" + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/preseed.cfg ", + "console=tty0 ", + "--- ", # Lines after this are copied to the resulting system?! + "biosdevnames=0 ", + "net.ifnames=0 ", + "" ] http_directory = "distros/debian/9/http/" diff --git a/distros/debian/9/finalize.sh b/distros/debian/9/finalize.sh index 52930fb..583a457 100644 --- a/distros/debian/9/finalize.sh +++ b/distros/debian/9/finalize.sh @@ -4,11 +4,5 @@ set -ex apt update apt upgrade -y -# Configure sshd to be faster -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf -UseDNS no -PubkeyAcceptedKeyTypes +ssh-rsa -EOF - # Clean up after ourselves apt-get clean diff --git a/distros/debian/9/virtualbox.sh b/distros/debian/9/virtualbox.sh index c7ca72d..998449c 100644 --- a/distros/debian/9/virtualbox.sh +++ b/distros/debian/9/virtualbox.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash set -ex -packages="bzip2 dkms build-essential linux-headers-$(uname -r)" -apt install -y ${packages} # Intentionally not quoted +packages=(bzip2 dkms build-essential "linux-headers-$(uname -r)") +apt install -y "${packages[@]}" mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt /mnt/VBoxLinuxAdditions.run install 2>&1 | tee /root/vbox_addon_install.log -apt remove -y ${packages} # Also intentionally not quoted +apt remove -y "${packages[@]}" umount /mnt rm /home/vagrant/VBoxGuestAdditions.iso diff --git a/distros/fedora/37/amd64.pkrvars.hcl b/distros/fedora/37/amd64.pkrvars.hcl index 42bd239..55c88d2 100644 --- a/distros/fedora/37/amd64.pkrvars.hcl +++ b/distros/fedora/37/amd64.pkrvars.hcl @@ -1,13 +1,13 @@ -distro = "fedora" +distro = "fedora" version = "37" iso = { - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/37/Server/x86_64/iso/Fedora-Server-dvd-x86_64-37-1.7.iso" - checksum = "0a4de5157af47b41a07a53726cd62ffabd04d5c1a4afece5ee7c7a84c1213e4f" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/37/Server/x86_64/iso/Fedora-Server-dvd-x86_64-37-1.7.iso" + checksum = "0a4de5157af47b41a07a53726cd62ffabd04d5c1a4afece5ee7c7a84c1213e4f" } boot_command = [ "e ", "net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/x86_64.ks console=tty0" ] cd_files = [ - "distros/fedora/37/*.ks" + "distros/fedora/37/*.ks" ] diff --git a/distros/fedora/38/amd64.pkrvars.hcl b/distros/fedora/38/amd64.pkrvars.hcl index 4d7ca0e..2a1687a 100644 --- a/distros/fedora/38/amd64.pkrvars.hcl +++ b/distros/fedora/38/amd64.pkrvars.hcl @@ -1,13 +1,13 @@ -distro = "fedora" +distro = "fedora" version = "38" iso = { - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/38/Server/x86_64/iso/Fedora-Server-dvd-x86_64-38-1.6.iso" - checksum = "66b52d7cb39386644cd740930b0bef0a5a2f2be569328fef6b1f9b3679fdc54d" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/38/Server/x86_64/iso/Fedora-Server-dvd-x86_64-38-1.6.iso" + checksum = "66b52d7cb39386644cd740930b0bef0a5a2f2be569328fef6b1f9b3679fdc54d" } boot_command = [ - "e ", - "net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/x86_64.ks console=tty0" + "e ", + "net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/x86_64.ks console=tty0" ] cd_files = [ - "distros/fedora/38/*.ks" + "distros/fedora/38/*.ks" ] diff --git a/distros/fedora/39/amd64.pkrvars.hcl b/distros/fedora/39/amd64.pkrvars.hcl index a4b1d80..fdd6404 100644 --- a/distros/fedora/39/amd64.pkrvars.hcl +++ b/distros/fedora/39/amd64.pkrvars.hcl @@ -1,13 +1,13 @@ -distro = "fedora" +distro = "fedora" version = "39" iso = { - url = "https://download.fedoraproject.org/pub/fedora/linux/releases/39/Server/x86_64/iso/Fedora-Server-dvd-x86_64-39-1.5.iso" - checksum = "2755cdff6ac6365c75be60334bf1935ade838fc18de53d4c640a13d3e904f6e9" + url = "https://download.fedoraproject.org/pub/fedora/linux/releases/39/Server/x86_64/iso/Fedora-Server-dvd-x86_64-39-1.5.iso" + checksum = "2755cdff6ac6365c75be60334bf1935ade838fc18de53d4c640a13d3e904f6e9" } boot_command = [ - "e ", - "net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/x86_64.ks console=tty0" + "e ", + "net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/x86_64.ks console=tty0" ] cd_files = [ - "distros/fedora/39/*.ks" + "distros/fedora/39/*.ks" ] diff --git a/distros/fedora/rawhide/amd64.pkrvars.hcl.sh b/distros/fedora/rawhide/amd64.pkrvars.hcl.sh index 819f4ee..7dbf317 100755 --- a/distros/fedora/rawhide/amd64.pkrvars.hcl.sh +++ b/distros/fedora/rawhide/amd64.pkrvars.hcl.sh @@ -14,16 +14,16 @@ checksums="${tmp}/checksums" # First, find the proper URL, since it updates every build curl -L -o "${listing}" "${fedora}" -links="$(cat "${listing}" | pup 'a[href*=".iso"] attr{href}' | grep dvd)" -iso_name="$(echo "${links}" | grep -e 'iso$')" +links="$(pup -f "${listing}" 'a[href*=".iso"] attr{href}' | grep dvd)" +iso_name="$(echo "${links}" | grep -e 'iso$' | head -1)" iso="${fedora}${iso_name}" # Read the SHA256 sum value -sums="$(cat "${listing}" | pup 'a[href*="CHECKSUM"] attr{href}')" +sums="$(pup -f "${listing}" 'a[href*="CHECKSUM"] attr{href}' | head -1)" until curl -f -L -o "${checksums}" "${fedora}${sums}"; do sleep 1 done -sha="$(cat "${checksums}" | grep dvd | grep SHA256 | cut -d' ' -f 4)" +sha="$(grep -e dvd "${checksums}" | grep SHA256 | cut -d' ' -f 4)" # Write out HCL file cat << EOF > "${name}" diff --git a/distros/nixos/23.05/amd64.pkrvars.hcl.sh b/distros/nixos/23.05/amd64.pkrvars.hcl.sh index 917133b..d8d8c91 100755 --- a/distros/nixos/23.05/amd64.pkrvars.hcl.sh +++ b/distros/nixos/23.05/amd64.pkrvars.hcl.sh @@ -18,7 +18,7 @@ curl -L -o "${checksums}" "${base}.sha256" until curl -f -L -o "${checksums}" "${base}.sha256"; do sleep 1 done -sha="$(cat "${checksums}" | grep minimal | cut -d' ' -f 1)" +sha="$(grep -e minimal "${checksums}" | cut -d' ' -f 1)" # Write out HCL file cat << EOF > "${name}" diff --git a/distros/nixos/23.11/amd64.pkrvars.hcl.sh b/distros/nixos/23.11/amd64.pkrvars.hcl.sh index 92d2af4..3fb7b84 100755 --- a/distros/nixos/23.11/amd64.pkrvars.hcl.sh +++ b/distros/nixos/23.11/amd64.pkrvars.hcl.sh @@ -18,7 +18,7 @@ curl -L -o "${checksums}" "${base}.sha256" until curl -f -L -o "${checksums}" "${base}.sha256"; do sleep 1 done -sha="$(cat "${checksums}" | grep minimal | cut -d' ' -f 1)" +sha="$(grep -e minimal "${checksums}" | cut -d' ' -f 1)" # Write out HCL file cat << EOF > "${name}" diff --git a/distros/ubuntu/18.04/amd64.pkrvars.hcl b/distros/ubuntu/18.04/amd64.pkrvars.hcl index 363744d..c90d979 100644 --- a/distros/ubuntu/18.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/18.04/amd64.pkrvars.hcl @@ -1,23 +1,23 @@ -distro = "ubuntu" +distro = "ubuntu" version = "18.04" iso = { - url = "http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.6-server-amd64.iso" - checksum = "f5cbb8104348f0097a8e513b10173a07dbc6684595e331cb06f93f385d0aecf6" + url = "http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.6-server-amd64.iso" + checksum = "f5cbb8104348f0097a8e513b10173a07dbc6684595e331cb06f93f385d0aecf6" } boot_command = [ - "", - "", - "auto=true priority=critical ", - "locale=en_US.UTF-8 ", - "DEBIAN_FRONTEND=text ", - "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ", - "fsck.mode=skip ", - "console=tty0 ", - "--- net.ifnames=0 biosdevnames=0 ", - "" + "", + "", + "auto=true priority=critical ", + "locale=en_US.UTF-8 ", + "DEBIAN_FRONTEND=text ", + "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ", + "fsck.mode=skip ", + "console=tty0 ", + "--- net.ifnames=0 biosdevnames=0 ", + "" ] http_files = { - "/preseed.cfg" = < /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/distros/ubuntu/20.04/amd64.pkrvars.hcl b/distros/ubuntu/20.04/amd64.pkrvars.hcl index 69f5e11..baeacd6 100644 --- a/distros/ubuntu/20.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/20.04/amd64.pkrvars.hcl @@ -1,19 +1,19 @@ -distro = "ubuntu" +distro = "ubuntu" version = "20.04" iso = { - url = "https://releases.ubuntu.com/20.04/ubuntu-20.04.6-live-server-amd64.iso" - checksum = "b8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b" + url = "https://releases.ubuntu.com/20.04/ubuntu-20.04.6-live-server-amd64.iso" + checksum = "b8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b" } boot_wait = "3s" boot_command = [ - "", - "console=tty0 ", - "fsck.mode=skip ", - "locale=en_US ", - "auto=true ", - "priority=critical ", - "autoinstall ds=nocloud" + "", + "console=tty0 ", + "fsck.mode=skip ", + "locale=en_US ", + "auto=true ", + "priority=critical ", + "autoinstall ds=nocloud" ] cd_files = [ - "distros/ubuntu/20.04/disc/*" + "distros/ubuntu/20.04/disc/*" ] diff --git a/distros/ubuntu/20.04/finalize.sh b/distros/ubuntu/20.04/finalize.sh index 35c89ad..19345a6 100644 --- a/distros/ubuntu/20.04/finalize.sh +++ b/distros/ubuntu/20.04/finalize.sh @@ -10,7 +10,7 @@ apt upgrade -y sed -i -E -e 's,^(ACTIVE_CONSOLES="/dev/tty).*",\11,' /etc/default/console-setup # Make sshd faster -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/distros/ubuntu/22.04/amd64.pkrvars.hcl b/distros/ubuntu/22.04/amd64.pkrvars.hcl index 210b88d..c4f4049 100644 --- a/distros/ubuntu/22.04/amd64.pkrvars.hcl +++ b/distros/ubuntu/22.04/amd64.pkrvars.hcl @@ -1,19 +1,19 @@ -distro = "ubuntu" +distro = "ubuntu" version = "22.04" iso = { - url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso" - checksum = "a4acfda10b18da50e2ec50ccaf860d7f20b389df8765611142305c0e911d16fd" + url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso" + checksum = "a4acfda10b18da50e2ec50ccaf860d7f20b389df8765611142305c0e911d16fd" } boot_command = [ - "e", - "console=tty0 ", - "fsck.mode=skip ", - "locale=en_US ", - "auto=true ", - "priority=critical ", - "autoinstall", - "", + "e", + "console=tty0 ", + "fsck.mode=skip ", + "locale=en_US ", + "auto=true ", + "priority=critical ", + "autoinstall", + "", ] cd_files = [ - "distros/ubuntu/22.04/disc/*" + "distros/ubuntu/22.04/disc/*" ] diff --git a/distros/ubuntu/22.04/finalize.sh b/distros/ubuntu/22.04/finalize.sh index 35c89ad..19345a6 100644 --- a/distros/ubuntu/22.04/finalize.sh +++ b/distros/ubuntu/22.04/finalize.sh @@ -10,7 +10,7 @@ apt upgrade -y sed -i -E -e 's,^(ACTIVE_CONSOLES="/dev/tty).*",\11,' /etc/default/console-setup # Make sshd faster -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/distros/ubuntu/23.10/amd64.pkrvars.hcl b/distros/ubuntu/23.10/amd64.pkrvars.hcl index eacd069..d664468 100644 --- a/distros/ubuntu/23.10/amd64.pkrvars.hcl +++ b/distros/ubuntu/23.10/amd64.pkrvars.hcl @@ -1,19 +1,19 @@ -distro = "ubuntu" +distro = "ubuntu" version = "23.10" iso = { - url = "http://releases.ubuntu.com/23.10/ubuntu-23.10-live-server-amd64.iso" - checksum = "d2fb80d9ce77511ed500bcc1f813e6f676d4a3577009dfebce24269ca23346a5" + url = "http://releases.ubuntu.com/23.10/ubuntu-23.10-live-server-amd64.iso" + checksum = "d2fb80d9ce77511ed500bcc1f813e6f676d4a3577009dfebce24269ca23346a5" } boot_command = [ - "e", - "console=tty0 ", - "fsck.mode=skip ", - "locale=en_US ", - "auto=true ", - "priority=critical ", - "autoinstall", - "", + "e", + "console=tty0 ", + "fsck.mode=skip ", + "locale=en_US ", + "auto=true ", + "priority=critical ", + "autoinstall", + "", ] cd_files = [ - "distros/ubuntu/23.10/disc/*" + "distros/ubuntu/23.10/disc/*" ] diff --git a/distros/ubuntu/23.10/finalize.sh b/distros/ubuntu/23.10/finalize.sh index 35c89ad..19345a6 100644 --- a/distros/ubuntu/23.10/finalize.sh +++ b/distros/ubuntu/23.10/finalize.sh @@ -10,7 +10,7 @@ apt upgrade -y sed -i -E -e 's,^(ACTIVE_CONSOLES="/dev/tty).*",\11,' /etc/default/console-setup # Make sshd faster -echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf +cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf UseDNS no PubkeyAcceptedKeyTypes +ssh-rsa EOF diff --git a/lib/build.py b/lib/build.py index 9f48cf8..a0fa1c2 100644 --- a/lib/build.py +++ b/lib/build.py @@ -5,11 +5,29 @@ class Build: def __init__(self, distro, version, provider: Provider): self.distro: str = distro self.version: str = str(version) - self.provider: str = provider + self.provider: Provider = provider @property def var_file(self): - return f"-var-file=distros/{self.distro}/{self.version}/{self.provider.arch}.pkrvars.hcl" + return f"-var-file={self.var_path}" + + @property + def matrix(self): + return { + "builder": str(self.provider), + "distro": self.var_path, + "runner": self.provider.runner, + } + + @property + def is_github(self) -> bool: + if self.provider.runner is not None: + return True + return False + + @property + def var_path(self): + return f"distros/{self.distro}/{self.version}/{self.provider.arch}.pkrvars.hcl" @property def only(self): diff --git a/lib/provider.py b/lib/provider.py index 49fc2de..1642ce3 100644 --- a/lib/provider.py +++ b/lib/provider.py @@ -5,3 +5,11 @@ class Provider: def __str__(self) -> str: return f"{self.name}.{self.arch}" + + @property + def runner(self) -> str: + if self.name == "qemu": + return "ubuntu-latest" + elif self.name.startswith("virtualbox"): + return "macos-12" + return None diff --git a/modify_timeout.sh b/modify_timeout.sh index 0407bb2..de31e61 100755 --- a/modify_timeout.sh +++ b/modify_timeout.sh @@ -4,11 +4,11 @@ set -exo pipefail distro="${1}" # Find URL -url="$(cat "${distro}" | grep url | cut -f2 -d'"')" +url="$(grep -e url "${distro}" | cut -f2 -d'"')" curl -C - -O "${url}" # Mount and extract -file=$(printf "${url}" | sed -E -e 's#.*/(.*)$#\1#') +file=$(printf '%s' "${url}" | sed -E -e 's#.*/(.*)$#\1#') work="$(mktemp -d)" xorriso -osirrox on -indev "${file}" -extract / "${work}" diff --git a/scripts/minimize.sh b/scripts/minimize.sh index 6b7d6e5..1407cd7 100644 --- a/scripts/minimize.sh +++ b/scripts/minimize.sh @@ -13,15 +13,15 @@ if [ ! -e /etc/fedora-release ]; then fi # In CentOS 7, blkid returns duplicate devices -swap_device_uuid=`sudo /sbin/blkid -t TYPE=swap -o value -s UUID | uniq` -swap_device_label=`sudo /sbin/blkid -t TYPE=swap -o value -s LABEL | uniq` +swap_device_uuid=$(sudo /sbin/blkid -t TYPE=swap -o value -s UUID | uniq) +swap_device_label=$(sudo /sbin/blkid -t TYPE=swap -o value -s LABEL | uniq) if [ -n "$swap_device_uuid" ]; then - swap_device=`readlink -f /dev/disk/by-uuid/"$swap_device_uuid"` + swap_device=$(readlink -f /dev/disk/by-uuid/"$swap_device_uuid") elif [ -n "$swap_device_label" ]; then - swap_device=`readlink -f /dev/disk/by-label/"$swap_device_label"` + swap_device=$(readlink -f /dev/disk/by-label/"$swap_device_label") fi -if [ ! -z "${swap_device}" -a -e "${swap_device}" ]; then +if [ -n "${swap_device}" ] && [ -e "${swap_device}" ]; then sudo /sbin/swapoff "$swap_device" sudo dd if=/dev/zero of="$swap_device" bs=1M || : sudo /sbin/mkswap ${swap_device_label:+-L "$swap_device_label"} ${swap_device_uuid:+-U "$swap_device_uuid"} "$swap_device" diff --git a/scripts/vagrant.sh b/scripts/vagrant.sh index 669b159..a56e40b 100644 --- a/scripts/vagrant.sh +++ b/scripts/vagrant.sh @@ -2,6 +2,7 @@ set -ex # Configure vagrant user's SSH key +# shellcheck disable=SC2174 mkdir -m 0700 -p ~vagrant/.ssh curl -L -o ~vagrant/.ssh/authorized_keys "https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub" chmod 600 ~vagrant/.ssh/authorized_keys diff --git a/sources/build.pkr.hcl b/sources/build.pkr.hcl index 0975f8b..2d68c2d 100644 --- a/sources/build.pkr.hcl +++ b/sources/build.pkr.hcl @@ -14,11 +14,11 @@ packer { } vmware = { version = ">= 1.0" - source = "github.com/hashicorp/vmware" + source = "github.com/hashicorp/vmware" } hyperv = { version = "= 1.1.1" - source = "github.com/hashicorp/hyperv" + source = "github.com/hashicorp/hyperv" } virtualbox = { source = "github.com/hashicorp/virtualbox" @@ -28,56 +28,56 @@ packer { } build { - sources = [ - "source.qemu.amd64", - "source.virtualbox-iso.amd64", - "source.vmware-iso.amd64", - "source.hyperv-iso.amd64" - ] + sources = [ + "source.qemu.amd64", + "source.virtualbox-iso.amd64", + "source.vmware-iso.amd64", + "source.hyperv-iso.amd64" + ] - # If anything needs specific support for one of the distros - provisioner "shell" { - execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" - only = ["qemu.amd64"] - script = "distros/${var.distro}/${var.version}/qemu.sh" - } - provisioner "shell" { - execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" - only = ["virtualbox-iso.amd64"] - script = "distros/${var.distro}/${var.version}/virtualbox.sh" - } - provisioner "shell" { - execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" - only = ["vmware-iso.amd64"] - script = "distros/${var.distro}/${var.version}/vmware.sh" - } + # If anything needs specific support for one of the distros + provisioner "shell" { + execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" + only = ["qemu.amd64"] + script = "distros/${var.distro}/${var.version}/qemu.sh" + } + provisioner "shell" { + execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" + only = ["virtualbox-iso.amd64"] + script = "distros/${var.distro}/${var.version}/virtualbox.sh" + } + provisioner "shell" { + execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" + only = ["vmware-iso.amd64"] + script = "distros/${var.distro}/${var.version}/vmware.sh" + } - # Generic wrapping up the provisioner before packaging - provisioner "shell" { - execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" - scripts = [ - "scripts/vagrant.sh", - "distros/${var.distro}/${var.version}/finalize.sh", - "scripts/minimize.sh" - ] - } + # Generic wrapping up the provisioner before packaging + provisioner "shell" { + execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'" + scripts = [ + "scripts/vagrant.sh", + "distros/${var.distro}/${var.version}/finalize.sh", + "scripts/minimize.sh" + ] + } - post-processors { - post-processor "vagrant" { - keep_input_artifact = true - compression_level = 9 - output = "output/{{ .Provider }}/${local.name}.box" - vagrantfile_template = "vagrant/${var.arch}.rb" - } + post-processors { + post-processor "vagrant" { + keep_input_artifact = true + compression_level = 9 + output = "output/{{ .Provider }}/${local.name}.box" + vagrantfile_template = "vagrant/${var.arch}.rb" + } - post-processor "vagrant-cloud" { - name = "upload" - access_token = var.vagrant_cloud_token - architecture = var.arch - box_tag = "boxen/${local.name}" - default_architecture = "amd64" - version = var.build - version_description = local.description - } - } + post-processor "vagrant-cloud" { + name = "upload" + access_token = var.vagrant_cloud_token + architecture = var.arch + box_tag = "boxen/${local.name}" + default_architecture = "amd64" + version = var.build + version_description = local.description + } + } } diff --git a/sources/hyperv-iso.pkr.hcl b/sources/hyperv-iso.pkr.hcl index 8d606be..0a4005e 100644 --- a/sources/hyperv-iso.pkr.hcl +++ b/sources/hyperv-iso.pkr.hcl @@ -1,26 +1,26 @@ source "hyperv-iso" "amd64" { - iso_url = var.iso.url - iso_checksum = var.iso.checksum - output_directory = "output/hyperv/${local.name}" + iso_url = var.iso.url + iso_checksum = var.iso.checksum + output_directory = "output/hyperv/${local.name}" - boot_command = var.boot_command - shutdown_command = var.shutdown_command - boot_wait = var.boot_wait - ssh_timeout = local.ssh.timeout - ssh_username = local.ssh.username - ssh_password = local.ssh.password - ssh_handshake_attempts = local.ssh.handshake_attempts - ssh_private_key_file = local.ssh.private_key_file - - vm_name = "packer-${local.name}" - disk_size = "${local.disk_size}000" - cpus = local.cpus - memory = local.memory - headless = var.headless + boot_command = var.boot_command + shutdown_command = var.shutdown_command + boot_wait = var.boot_wait + ssh_timeout = local.ssh.timeout + ssh_username = local.ssh.username + ssh_password = local.ssh.password + ssh_handshake_attempts = local.ssh.handshake_attempts + ssh_private_key_file = local.ssh.private_key_file - http_content = var.http_files - http_directory = var.http_directory - cd_content = var.cd_content - cd_files = var.cd_files - cd_label = var.cd_label + vm_name = "packer-${local.name}" + disk_size = "${local.disk_size}000" + cpus = local.cpus + memory = local.memory + headless = var.headless + + http_content = var.http_files + http_directory = var.http_directory + cd_content = var.cd_content + cd_files = var.cd_files + cd_label = var.cd_label } diff --git a/sources/inputs.pkr.hcl b/sources/inputs.pkr.hcl index 1e9dcd5..9c0095d 100644 --- a/sources/inputs.pkr.hcl +++ b/sources/inputs.pkr.hcl @@ -1,96 +1,111 @@ variable "iso" { - type = map(string) - description = "A map containing the URL and checksum for the ISO file" + type = map(string) + description = "A map containing the URL and checksum for the ISO file" } variable "distro" { - type = string - default = "unknown" + type = string + default = "unknown" } variable "arch" { - type = string - default = "amd64" + type = string + default = "amd64" } variable "version" { - type = string - description = "The distro version being specified" + type = string + description = "The distro version being specified" } variable "boot_wait" { - type = string - default = "15s" - description = "Length of time to wait before entering boot commands" + type = string + default = "15s" + description = "Length of time to wait before entering boot commands" } variable "boot_command" { - type = list(string) - default = [] + type = list(string) + default = [] } variable "shutdown_command" { - type = string - default = "sudo systemctl poweroff" + type = string + default = "sudo systemctl poweroff" } variable "headless" { - type = bool - default = true + type = bool + default = true } variable "vagrant_cloud_token" { - type = string - default = env("VAGRANT_CLOUD_TOKEN") + type = string + default = env("VAGRANT_CLOUD_TOKEN") } variable "build" { - type = string - default = "0.1" + type = string + default = "0.1" } variable "cd_content" { - type = map(string) - default = {} + type = map(string) + default = {} } variable "cd_files" { - type = list(string) - default = [] + type = list(string) + default = [] } variable "cd_label" { - type = string - default = "cidata" + type = string + default = "cidata" } variable "http_files" { - type = map(string) - default = {} + type = map(string) + default = {} } variable "http_directory" { - type = string - default = "" + type = string + default = "" +} + +variable "cpu_model" { + type = string + default = "host" +} + +variable "cpus" { + type = number + default = 4 +} + +variable "memory" { + type = number + default = 8192 } locals { - name = "${var.distro}-${var.version}" - description = templatefile("../README.box.md", { - distro = var.distro - arch = var.arch - version = var.version - build = var.build - }) + name = "${var.distro}-${var.version}" + description = templatefile("../README.box.md", { + distro = var.distro + arch = var.arch + version = var.version + build = var.build + }) - cpus = 4 - memory = 8192 - disk_size = 10 - ssh = { - username = "vagrant" - password = "vagrant" - handshake_attempts = 1000 - timeout = "5h45m" - private_key_file = "vagrant/insecure_key" - } + cpus = var.cpus + memory = var.memory + disk_size = 10 + ssh = { + username = "vagrant" + password = "vagrant" + handshake_attempts = 1000 + timeout = "5h45m" + private_key_file = "vagrant/insecure_key" + } } diff --git a/sources/qemu.pkr.hcl b/sources/qemu.pkr.hcl index 4170ac1..63b5f7c 100644 --- a/sources/qemu.pkr.hcl +++ b/sources/qemu.pkr.hcl @@ -1,44 +1,44 @@ variable "qemu_accelerator" { - type = string - default = "kvm" + type = string + default = "kvm" } source "qemu" "amd64" { - iso_url = var.iso.url - iso_checksum = var.iso.checksum - output_directory = "output/libvirt/${local.name}" + iso_url = var.iso.url + iso_checksum = var.iso.checksum + output_directory = "output/libvirt/${local.name}" - boot_command = var.boot_command - shutdown_command = var.shutdown_command - boot_wait = var.boot_wait - ssh_timeout = local.ssh.timeout - ssh_username = local.ssh.username - ssh_password = local.ssh.password - ssh_handshake_attempts = local.ssh.handshake_attempts - ssh_private_key_file = local.ssh.private_key_file + boot_command = var.boot_command + shutdown_command = var.shutdown_command + boot_wait = var.boot_wait + ssh_timeout = local.ssh.timeout + ssh_username = local.ssh.username + ssh_password = local.ssh.password + ssh_handshake_attempts = local.ssh.handshake_attempts + ssh_private_key_file = local.ssh.private_key_file - vm_name = "packer-${local.name}" - disk_size = "${local.disk_size}G" - cpus = local.cpus - memory = local.memory - headless = var.headless - disk_cache = "writeback" - format = "qcow2" - cpu_model = "host" + vm_name = "packer-${local.name}" + disk_size = "${local.disk_size}G" + cpus = local.cpus + memory = local.memory + headless = var.headless + disk_cache = "writeback" + format = "qcow2" + cpu_model = var.cpu_model - qemuargs = [ - #["-chardev", "stdio,id=char0,logfile=serial-output-qemu-${var.arch}-${var.distro}-${var.version},signal=off"], - #["-serial", "chardev:char0"], - ["-chardev", "socket,host=localhost,port=9876,server=on,wait=off,id=qga0"], - ["-device", "virtio-serial"], - ["-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"], - ["-qmp", "tcp:localhost:4444,server,wait=off"], - ] - accelerator = var.qemu_accelerator + qemuargs = [ + #["-chardev", "stdio,id=char0,logfile=serial-output-qemu-${var.arch}-${var.distro}-${var.version},signal=off"], + #["-serial", "chardev:char0"], + ["-chardev", "socket,host=localhost,port=9876,server=on,wait=off,id=qga0"], + ["-device", "virtio-serial"], + ["-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"], + ["-qmp", "tcp:localhost:4444,server,wait=off"], + ] + accelerator = var.qemu_accelerator - http_content = var.http_files - http_directory = var.http_directory - cd_content = var.cd_content - cd_files = var.cd_files - cd_label = var.cd_label + http_content = var.http_files + http_directory = var.http_directory + cd_content = var.cd_content + cd_files = var.cd_files + cd_label = var.cd_label } diff --git a/sources/virtualbox-iso.pkr.hcl b/sources/virtualbox-iso.pkr.hcl index 22c5e72..cdd8133 100644 --- a/sources/virtualbox-iso.pkr.hcl +++ b/sources/virtualbox-iso.pkr.hcl @@ -1,35 +1,35 @@ source "virtualbox-iso" "amd64" { - iso_url = var.iso.url - iso_checksum = var.iso.checksum - output_directory = "output/virtualbox/${local.name}" + iso_url = var.iso.url + iso_checksum = var.iso.checksum + output_directory = "output/virtualbox/${local.name}" - boot_command = var.boot_command - shutdown_command = var.shutdown_command - boot_wait = var.boot_wait + boot_command = var.boot_command + shutdown_command = var.shutdown_command + boot_wait = var.boot_wait - ssh_timeout = local.ssh.timeout - ssh_username = local.ssh.username - ssh_password = local.ssh.password - ssh_handshake_attempts = local.ssh.handshake_attempts - ssh_private_key_file = "vagrant/insecure_key" + ssh_timeout = local.ssh.timeout + ssh_username = local.ssh.username + ssh_password = local.ssh.password + ssh_handshake_attempts = local.ssh.handshake_attempts + ssh_private_key_file = "vagrant/insecure_key" - vm_name = "packer-${local.name}" - disk_size = "${local.disk_size}000" - cpus = local.cpus - memory = local.memory - headless = var.headless - guest_os_type = "Linux_64" - guest_additions_url = "http://download.virtualbox.org/virtualbox/7.0.10/VBoxGuestAdditions_7.0.10.iso" - guest_additions_sha256 = "bbabd89b8fff38a257bab039a278f0c4dc4426eff6e4238c1db01edb7284186a" - vboxmanage = [ - ["modifyvm", "{{ .Name }}", "--uart1", "0x3F8", "4"], - #["modifyvm", "{{ .Name }}", "--uartmode1", "file", "output/vritualbox/serial-${var.arch}-${var.distro}-${var.version}"], - ["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"], - ] + vm_name = "packer-${local.name}" + disk_size = "${local.disk_size}000" + cpus = local.cpus + memory = local.memory + headless = var.headless + guest_os_type = "Linux_64" + guest_additions_url = "http://download.virtualbox.org/virtualbox/7.0.10/VBoxGuestAdditions_7.0.10.iso" + guest_additions_sha256 = "bbabd89b8fff38a257bab039a278f0c4dc4426eff6e4238c1db01edb7284186a" + vboxmanage = [ + ["modifyvm", "{{ .Name }}", "--uart1", "0x3F8", "4"], + #["modifyvm", "{{ .Name }}", "--uartmode1", "file", "output/vritualbox/serial-${var.arch}-${var.distro}-${var.version}"], + ["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"], + ] - http_content = var.http_files - http_directory = var.http_directory - cd_content = var.cd_content - cd_files = var.cd_files - cd_label = var.cd_label + http_content = var.http_files + http_directory = var.http_directory + cd_content = var.cd_content + cd_files = var.cd_files + cd_label = var.cd_label } diff --git a/sources/vmware-iso.pkr.hcl b/sources/vmware-iso.pkr.hcl index d6ac47c..065eae2 100644 --- a/sources/vmware-iso.pkr.hcl +++ b/sources/vmware-iso.pkr.hcl @@ -1,28 +1,28 @@ source "vmware-iso" "amd64" { - iso_url = var.iso.url - iso_checksum = var.iso.checksum - output_directory = "output/vmware/${local.name}" + iso_url = var.iso.url + iso_checksum = var.iso.checksum + output_directory = "output/vmware/${local.name}" - boot_command = var.boot_command - shutdown_command = var.shutdown_command - boot_wait = var.boot_wait + boot_command = var.boot_command + shutdown_command = var.shutdown_command + boot_wait = var.boot_wait - ssh_timeout = local.ssh.timeout - ssh_username = local.ssh.username - ssh_password = local.ssh.password - ssh_handshake_attempts = local.ssh.handshake_attempts - ssh_private_key_file = "vagrant/insecure_key" + ssh_timeout = local.ssh.timeout + ssh_username = local.ssh.username + ssh_password = local.ssh.password + ssh_handshake_attempts = local.ssh.handshake_attempts + ssh_private_key_file = "vagrant/insecure_key" - vm_name = "packer-${local.name}" - disk_size = "${local.disk_size}000" - cpus = local.cpus - memory = local.memory - headless = var.headless - #guest_os_type = "Linux_64" + vm_name = "packer-${local.name}" + disk_size = "${local.disk_size}000" + cpus = local.cpus + memory = local.memory + headless = var.headless + #guest_os_type = "Linux_64" - http_content = var.http_files - http_directory = var.http_directory - cd_content = var.cd_content - cd_files = var.cd_files - cd_label = var.cd_label + http_content = var.http_files + http_directory = var.http_directory + cd_content = var.cd_content + cd_files = var.cd_files + cd_label = var.cd_label }