File tree Expand file tree Collapse file tree 3 files changed +76
-12
lines changed
Expand file tree Collapse file tree 3 files changed +76
-12
lines changed Original file line number Diff line number Diff line change 1- name : All
1+ name : CI
22on :
33 push :
44 branches :
5151 path : packer-builder-arm
5252 key : key-${{ github.sha }}-1
5353
54- build :
54+ test :
5555 needs : compile
5656 strategy :
5757 fail-fast : false
@@ -112,3 +112,60 @@ jobs:
112112
113113 - name : Build image
114114 run : sudo ./packer build boards/${{ matrix.boards }}
115+
116+ test-vagrant :
117+ needs : compile
118+ runs-on : macos-10.15
119+ name : Build board with vagrant
120+ steps :
121+ - uses : actions/checkout@v3.1.0
122+
123+ - name : Cache Vagrant boxes
124+ uses : actions/cache@v3
125+ with :
126+ path : ~/.vagrant.d/boxes
127+ key : ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
128+ restore-keys : |
129+ ${{ runner.os }}-vagrant-
130+
131+ - name : Show Vagrant version
132+ run : vagrant --version
133+
134+ - name : Install Vagrant plugins
135+ run : |
136+ vagrant plugin install vagrant-disksize
137+
138+ - name : Run vagrant up
139+ run : |
140+ vagrant up
141+
142+ - name : Upload source
143+ run : |
144+ git archive -o repo.tar.gz HEAD
145+ vagrant upload repo.tar.gz /home/vagrant/repo.tar.gz
146+ vagrant ssh -c " \
147+ rm -rf packer-builder-arm && \
148+ mkdir packer-builder-arm && \
149+ tar -xf repo.tar.gz -C packer-builder-arm \
150+ "
151+
152+ - name : Retrieve cache
153+ uses : actions/cache@v3
154+ with :
155+ path : packer-builder-arm
156+ key : key-${{ github.sha }}-1
157+
158+ - name : Upload packer-build-arm binary
159+ run : |
160+ vagrant upload packer-builder-arm /home/vagrant/packer-builder-arm/packer-builder-arm
161+
162+ - name : Build board
163+ run : |
164+ vagrant ssh -c " \
165+ cd packer-builder-arm && \
166+ sudo packer build boards/raspberry-pi-3/archlinuxarm.json \
167+ "
168+
169+ - name : Check result
170+ run : |
171+ vagrant ssh -c "ls -al packer-builder-arm/raspberry-pi-3.img"
Original file line number Diff line number Diff line change 66# backwards compatibility). Please don't change it unless you know what
77# you're doing.
88Vagrant . configure ( "2" ) do |config |
9- config . vm . box = "ubuntu/focal64 "
9+ config . vm . box = "ubuntu/jammy64 "
1010 config . disksize . size = '40GB'
1111
1212 config . vm . provision "shell" , inline : <<-SHELL
13+ set -o errtrace -o nounset -o pipefail -o errexit
1314 curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
1415 sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
1516
1617 apt-get update
17- apt-get install -y git golang qemu-user-static packer libarchive-tools
18- rm -rf packer-builder-arm *>/dev/null
18+ apt-get install -y qemu-user-static packer libarchive-tools
19+ #apt-get install -y git golang
20+ #rm -rf packer-builder-arm *>/dev/null
1921
20- git clone https://github.com/mkaczanowski/packer-builder-arm
21- cd packer-builder-arm
22- go mod download
23- go build
22+ # git clone https://github.com/mkaczanowski/packer-builder-arm
23+ # cd packer-builder-arm
24+ # go mod download
25+ # go build
2426
25- packer build boards/raspberry-pi-3/archlinuxarm.json
27+ # packer build boards/raspberry-pi-3/archlinuxarm.json
2628 SHELL
2729end
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ func checkBinfmtMisc(srcPath string) (string, error) {
1919 return "" , fmt .Errorf ("failed to read /proc/sys/fs/binfmt_misc directory: %v" , err )
2020 }
2121
22+ srcPathStat , _ := os .Stat (srcPath )
2223 for _ , file := range files {
2324 if file .Name () == "register" || file .Name () == "status" {
2425 continue
@@ -36,8 +37,12 @@ func checkBinfmtMisc(srcPath string) (string, error) {
3637 continue
3738 }
3839
39- if fields [0 ] == "interpreter" && fields [1 ] == srcPath {
40- return pth , nil
40+ if fields [0 ] == "interpreter" {
41+ fieldStat , _ := os .Stat (fields [1 ])
42+ // os.SameFile allows also comparing of sym- and relativ symlinks.
43+ if os .SameFile (fieldStat , srcPathStat ) {
44+ return pth , nil
45+ }
4146 }
4247 }
4348 }
You can’t perform that action at this time.
0 commit comments