~sxmo-infra/sxmo-image-builder

ref: f339003a6a7ead8dc4dadb66e2a6e90fa19b8494 sxmo-image-builder/.build.yml -rw-r--r-- 2.0 KiB
f339003aMiles Alan Roll 1.2.0 Image 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
image: alpine/3.12
packages: [coreutils, procps, py3-requests, xz]

environment:
  #DEVICE: pinebookpro
  DEVICE: pinephone
  VERSION: 1.2.0

secrets:
  - f9885226-5149-444b-9dad-2981b0f02816
  - a434f0f6-eb56-4b84-a0dd-77fc079450f8

sources:
  - "https://gitlab.com/postmarketOS/pmaports.git/"
  - "https://gitlab.com/postmarketOS/pmbootstrap.git/"

tasks:
  - setup_device: |
      sed -i s/DEVICE/$DEVICE/ sxmo-image-builder/pmbootstrap.cfg

  - setup_binfmt: |
      sudo modprobe binfmt_misc
      sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
    
  - setup_pmbootstrap: |
      mkdir -p ~/.config && cp sxmo-image-builder/pmbootstrap.cfg ~/.config/
      yes "" | ./pmbootstrap/pmbootstrap.py  --aports=$PWD/pmaports -q init   

  - build_image: |
      ./pmbootstrap/pmbootstrap.py chroot -b aarch64 ls
      ./pmbootstrap/pmbootstrap.py -mp=http://postmarketos1.brixit.nl/postmarketos/ update --arch aarch64 
      yes "mo" | ./pmbootstrap/pmbootstrap.py --details-to-stdout -mp=http://postmarketos1.brixit.nl/postmarketos/ install
      ./pmbootstrap/pmbootstrap.py export images
      sudo losetup /dev/loop0 images/pine64-$DEVICE.img
      sudo mkdir bootpart
      sudo mount -o loop /dev/loop0p1 bootpart
      sudo umount bootpart

  - compress_image: |
      du -h $(readlink images/pine64-$DEVICE.img)
      date
      sh -c 'xz -c $(readlink images/pine64-$DEVICE.img) > /home/build/compressed.img.xz'
      du -h /home/build/compressed.img.xz
      date
      
  - upload_image: |
      export TIME=$(date +%Y%m%d)
      ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(cat ~/.user_at_server) "mkdir -p /home/public/images.lrdu.org/$DEVICE/"
      scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /home/build/compressed.img.xz $(cat ~/.user_at_server):/home/public/images.lrdu.org/$DEVICE/sxmo_$DEVICE-sd.$VERSION-$TIME.img.xz

  - set_htaccess: |
      scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sxmo-image-builder/.htaccess $(cat ~/.user_at_server):/home/public/images.lrdu.org/.htaccess