From 2f1c9e1bc7764e89bf380d89fca53e9881ca3344 Mon Sep 17 00:00:00 2001 From: chifu1234 Date: Mon, 18 Sep 2023 17:38:07 +0200 Subject: [PATCH] update --- .github/workflows/build.yaml | 10 +++++++++- build.sh | 4 ++-- debian/debian.json.pkr.hcl | 7 +++++-- debian/machine-id.service | 11 +++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 debian/machine-id.service diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 650e3a0..900ec78 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,6 +2,8 @@ name: ci on: push: + tags: + - "v*" jobs: qemu: @@ -16,4 +18,10 @@ jobs: run: sudo apt update && sudo apt install -y genisoimage qemu-system-x86 gzip jq qemu-utils qemu - name: run ./build.sh - run: ./build.sh \ No newline at end of file + run: ./build.sh + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.TOKEN }}" + prerelease: false + files: | + ./build/*.gz \ No newline at end of file diff --git a/build.sh b/build.sh index 75708d3..94d592a 100755 --- a/build.sh +++ b/build.sh @@ -53,8 +53,8 @@ do rm ./tmp -rf text="new version for ${i%/} in version ${tversion}" release_id=$(curl -X POST -H "Authorization: Bearer $token" -H "X-GitHub-Api-Version: 2022-11-28" -H "Accept: application/vnd.github+json" --data "$(post_data)" "https://api.github.com/repos/$repo_full_name/releases" | jq .id) - curl --data-binary @${build_dir}/${version}.qcow2.gz -H "Authorization: Bearer $token" -H "Content-Type: application/octet-stream" "https://uploads.github.com/repos/$repo_full_name/releases/$release_id/assets?name=${version}.qcow2.gz&access_token=$token" - sudo rm -rf @${build_dir}/ + #curl --data-binary @${build_dir}/${version}.qcow2.gz -H "Authorization: Bearer $token" -H "Content-Type: application/octet-stream" "https://uploads.github.com/repos/$repo_full_name/releases/$release_id/assets?name=${version}.qcow2.gz&access_token=$token" + #sudo rm -rf @${build_dir}/ git fetch --all --tags fi done diff --git a/debian/debian.json.pkr.hcl b/debian/debian.json.pkr.hcl index db48ee0..6c26640 100644 --- a/debian/debian.json.pkr.hcl +++ b/debian/debian.json.pkr.hcl @@ -72,9 +72,12 @@ source "qemu" "autogenerated_1" { # https://www.packer.io/docs/templates/hcl_templates/blocks/build build { sources = ["source.qemu.autogenerated_1"] - + provisioner "file" { + source = "debian/machine-id.service" + destination = "/tmp/machine-id.service" + } provisioner "shell" { - inline = ["sudo apt update && sudo apt -y install open-iscsi", "sudo apt install qemu-guest-agent -y && sudo systemctl enable qemu-guest-agent", "ls -lah /etc/udev/rules.d/", "sudo su -c 'echo owner @{PROC}/@{pid}/task/[0-9]*/comm rw, >> /etc/apparmor.d/sbin.dhclient'", "echo 'reset cloud-init' && sudo cloud-init clean"] + inline = ["sudo apt update && sudo apt -y install open-iscsi", "sudo apt install qemu-guest-agent -y && sudo systemctl enable qemu-guest-agent", "echo 'reset cloud-init' && sudo su -c 'echo -n > /etc/machine-id' && sudo cloud-init clean"] } } diff --git a/debian/machine-id.service b/debian/machine-id.service new file mode 100644 index 0000000..0b94e94 --- /dev/null +++ b/debian/machine-id.service @@ -0,0 +1,11 @@ +[Unit] +After=systemd-remount-fs.service +Before=systemd-sysusers.service systemd-vconsole-setup.service sysinit.target first-boot-complete.target shutdown.target +ConditionPathExists=!/etc/machine-id + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemd-machine-id-setup +StandardOutput=tty +StandardInput=tty +StandardError=tty \ No newline at end of file