diff --git a/.github/workflows/build-beta-images.yml b/.github/workflows/build-beta-images.yml index af297715f1..1583d5e6fc 100644 --- a/.github/workflows/build-beta-images.yml +++ b/.github/workflows/build-beta-images.yml @@ -1,1109 +1,236 @@ -name: Beta images +name: Build beta images on: - workflow_dispatch: - + inputs: + build_chunks: + description: 'Build chunks' + required: true + default: '22' workflow_run: - - workflows: ["Build"] - branches: [master] + workflows: ["Build beta & edge"] types: - completed - jobs: - worker-1: - - name: CLI worker 1/5 - runs-on: [self-hosted, Linux, images] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-cli-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-0.conf userpatches/targets.conf # Building chunk 1 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-2: - - name: CLI worker 2/5 - runs-on: [self-hosted, Linux, images] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-cli-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-1.conf userpatches/targets.conf # Building chunk 2 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-3: - - name: CLI worker 3/5 - runs-on: [self-hosted, Linux, images] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-cli-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-2.conf userpatches/targets.conf # Building chunk 3 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-4: - - name: CLI worker 4/5 - runs-on: [self-hosted, Linux, images] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-cli-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-3.conf userpatches/targets.conf # Building chunk 4 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-5: - - name: CLI worker 5/5 - runs-on: [self-hosted, Linux, images] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-cli-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-4.conf userpatches/targets.conf # Building chunk 5 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-a: - - name: Desktop worker 1/5 - runs-on: [self-hosted, Linux, images, big] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/8000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-desktop-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-0.conf userpatches/targets.conf # Building chunk 1 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-b: - - name: Desktop worker 2/5 - runs-on: [self-hosted, Linux, images, big] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/8000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-desktop-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-1.conf userpatches/targets.conf # Building chunk 2 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-c: - - name: Desktop worker 3/5 - runs-on: [self-hosted, Linux, images, big] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/8000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-desktop-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-2.conf userpatches/targets.conf # Building chunk 3 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-d: - - name: Desktop worker 4/5 - runs-on: [self-hosted, Linux, images, big] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/8000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-desktop-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-3.conf userpatches/targets.conf # Building chunk 4 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - worker-e: - - name: Desktop worker 5/5 - runs-on: [self-hosted, Linux, images, big] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - # make sure no temporally dirs are mounted from previous runs - while : - do - sudo pkill compile.sh || true - sudo pkill arm-binfmt-P || true - sudo pkill aarch64-binfmt-P || true - sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break - echo "Mounted temp directories. Trying to unmount." - df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true - sleep 10 - done - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Checkout Armbian support scripts - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/scripts - token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} - path: scripts - clean: false - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build beta images - env: - GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} - - run: | - - cd build - - # use prepared configs - sudo mkdir -p userpatches - sudo cp ../scripts/configs/* userpatches/ - - # prepare host - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - - # sync rootfs - mkdir -p cache/rootfs/ - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ - - # calculate how many images we can build in parallel - PARALLEL_BUILDS=$(awk '{printf("%d",$1/8000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) - - # cleaning leftovers if any - rm -rf output/images/* output/debs-beta/* output/debs/* - - # split into 5 build chunks - cat config/targets-desktop-beta.conf | grep -v "^$" | grep -v "^#" > userpatches/split.conf - split -d --number=l/5 --additional-suffix=.conf --suffix-length=1 userpatches/split.conf userpatches/split- - - sudo ln -sf split-4.conf userpatches/targets.conf # Building chunk 5 - - ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" - - - name: Install SSH key for storage - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/build/output/images/ - lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/images/ images/ ;bye" sftp://users.armbian.com - - torrents: - - # - # Rebuilt torrent files for rootfs cache - # - - name: Update download infrastructure - needs: [worker-1, worker-2, worker-3, worker-4, worker-5, worker-a, worker-b, worker-c, worker-d, worker-e] - runs-on: [self-hosted, Linux, local] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Install SSH key for torrent - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - name: id_torrent # optional - known_hosts: ${{ secrets.KNOWN_HOSTS_TORRENTS }} - if_key_exists: replace - - - name: Create torrents - - run: ssh -T -i ~/.ssh/id_torrent ${{ secrets.USER_TORRENTS }}@${{ secrets.HOST_TORRENTS }} + Prepare: + + runs-on: [self-hosted, Linux, images] + if: ${{ github.repository_owner == 'armbian' }} + outputs: + matrix: ${{steps.list_dirs.outputs.matrix}} + steps: + + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/build + path: build + ref: nightly + clean: false + + - name: Install SSH key for storage + + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.KEY_TORRENTS }} + known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} + if_key_exists: replace + + - name: Clean upload folder + + run: | + + cd build + while sudo mountpoint output/images -q + do + sudo umount output/images || true + echo "Trying to unmount ..." + sleep 10 + done + sudo apt-get -y -qq install sshfs + sudo mkdir -p /root/.ssh/ + sudo cp ~/.ssh/known_hosts /root/.ssh/ + sudo rm -rf output/images/* + sudo mkdir -p output/images + sudo sshfs upload@users.armbian.com:/images output/images -o IdentityFile=~/.ssh/id_rsa + sudo find output/images/ -mindepth 1 -type d -exec sudo rm -rf {} \; 2>/dev/null || true + while sudo mountpoint output/images -q + do + sudo umount output/images || true + echo "Trying to unmount ..." + sleep 10 + done + + - name: Cut the job into chunks + run: | + + mkdir -p temp + # clean leftovers + sudo rm -rf temp/* + cat build/config/targets-cli-beta.conf build/config/targets-desktop-beta.conf | grep -v "^$" | grep -v "^#" | shuf > temp/split.conf + split -d --numeric=1 --number=r/${{ github.event.inputs.build_chunks }} --additional-suffix=.conf --suffix-length=2 temp/split.conf temp/split- + + - name: Prepare matrix + id: list_dirs + run: + echo ::set-output name=matrix::$(for x in $(seq -w 01 ${{ github.event.inputs.build_chunks }}); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq) + + - name: Cache build configurations + uses: actions/cache@v2 + env: + cache-name: cache-build + with: + path: temp + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} + + Job: # short name because Github will expand with the matrix values + + needs: [ Prepare ] + runs-on: [self-hosted, Linux, images] + if: ${{ github.repository_owner == 'armbian' }} + timeout-minutes: 480 + strategy: + fail-fast: false + matrix: + node: ${{fromJson(needs.Prepare.outputs.matrix)}} + + steps: + + - name: Cache Gradle packages + uses: actions/cache@v2 + env: + cache-name: cache-build + with: + path: temp + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} + + - name: Fix permissions + run: | + + # make sure no temporally dirs are mounted from previous runs + while : + do + sudo pkill compile.sh || true + sudo pkill arm-binfmt-P || true + sudo pkill aarch64-binfmt-P || true + sudo pkill pixz || true + sudo mountpoint -q build/output/images && sudo fusermount -u build/output/images || true + [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 && $(sudo mountpoint -q build/output/images; echo $?) -eq 1 ]] && sudo rm -rf build/.tmp && break + echo "Mounted temp directories. Trying to unmount." + df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true + sleep 10 + done + [[ -d build/.git ]] && sudo chown -R $USER:$USER build/.git || true + [[ -d build/output/images ]] && sudo rm -rf build/output/images/* || true + + - name: Checkout Armbian build script + + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/build + path: build + ref: nightly + clean: false + + - name: Checkout Armbian support scripts + + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/scripts + token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} + path: scripts + clean: false + + - name: Import GPG key + + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ secrets.GPG_KEY1 }} + passphrase: ${{ secrets.GPG_PASSPHRASE1 }} + workdir: scripts + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Install SSH key for storage + + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.KEY_TORRENTS }} + known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} + if_key_exists: replace + + - name: Build beta images + env: + GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }} + + run: | + + CHUNK="${{ matrix.node }}" + cd build + # use prepared configs + sudo mkdir -p userpatches + sudo cp ../scripts/configs/* userpatches/ + # prepare host + [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes + ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' + # mount or sync rootfs + sudo mount cache/rootfs || true + sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ + # calculate how many images we can build in parallel + PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) + # mount deploy target + sudo apt-get -y -qq install sshfs + sudo mkdir -p /root/.ssh/ + sudo cp ~/.ssh/known_hosts /root/.ssh/ + sudo mkdir -p output/images || true + sudo sshfs upload@users.armbian.com:/images output/images -o IdentityFile=~/.ssh/id_rsa + # link build targets + sudo ln -sf ../../temp/split-${CHUNK}.conf userpatches/targets.conf + ./compile.sh all-new-beta-images MULTITHREAD="${PARALLEL_BUILDS}" GPG_PASS="${GPG_PASS}" + # umount + while mountpoint output/images -q + do + sudo umount output/images || true + echo "Trying to unmount ..." + sleep 10 + done + cp -R output/debug/Armbian ../temp + + Deploy: + + name: Update download infrastructure + needs: [Job] + runs-on: [self-hosted, Linux, local] + if: ${{ github.repository_owner == 'Armbian' }} + steps: + - name: Cache Gradle packages + uses: actions/cache@v2 + env: + cache-name: cache-build + with: + path: temp + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} + + - name: upload artefacts + uses: actions/upload-artifact@v2 + with: + name: logs + path: temp/Armbian/ + + - name: Install SSH key for torrent + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.KEY_TORRENTS }} + name: id_torrent # optional + known_hosts: ${{ secrets.KNOWN_HOSTS_TORRENTS }} + if_key_exists: replace + - name: Create torrents + run: ssh -T -i ~/.ssh/id_torrent ${{ secrets.USER_TORRENTS }}@${{ secrets.HOST_TORRENTS }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b261eee2d..5774a3acc9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,13 +69,14 @@ jobs: sudo pkill arm-binfmt-P || true sudo pkill aarch64-binfmt-P || true sudo pkill pixz || true - [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break + sudo mountpoint -q build/output/images && sudo fusermount -u build/output/images || true + [[ "$(df | grep "/.tmp" | wc -l)" -eq 0 ]] && sudo rm -rf build/.tmp && break echo "Mounted temp directories. Trying to unmount." df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true sleep 10 done - sudo chown -R $USER:$USER . + sudo chown -R $USER:$USER build/.git - name: Checkout Armbian build script @@ -103,7 +104,7 @@ jobs: echo "BLTPATH=\"$(pwd)/build/\"" | tee scripts/cacherebuild.conf scripts/betarepository.conf >/dev/null cd build - rm -rf output/images/* + sudo rm -rf output/images/* sudo mkdir -p userpatches sudo cp ../scripts/configs/* userpatches/ [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes @@ -260,7 +261,7 @@ jobs: sleep 10 done - sudo chown -R $USER:$USER . + sudo chown -R $USER:$USER build/.git - name: Checkout Armbian build script @@ -372,7 +373,7 @@ jobs: fi sudo git checkout -f - sudo chown -R $USER:$USER . + sudo chown -R $USER:$USER .git git pull echo "${NEW_VERSION}" > VERSION git config --global user.email "info@armbian.com" @@ -435,7 +436,7 @@ jobs: sleep 10 done - sudo chown -R $USER:$USER . + sudo chown -R $USER:$USER build/.git - name: Checkout Armbian build script diff --git a/lib/debootstrap.sh b/lib/debootstrap.sh index 30dc27356e..862b7c7ce8 100644 --- a/lib/debootstrap.sh +++ b/lib/debootstrap.sh @@ -771,7 +771,7 @@ create_image() else FINALDEST=$DEST/images/"${BOARD}"/archive fi - install -d -o nobody -g nogroup -m 775 ${FINALDEST} + install -d ${FINALDEST} fi @@ -856,7 +856,7 @@ create_image() # move artefacts from temporally directory to its final destination [[ -n $compression_type ]] && rm $DESTIMG/${version}.img - mv $DESTIMG/${version}* ${FINALDEST} + rsync -a --no-owner --no-group --remove-source-files $DESTIMG/${version}* ${FINALDEST} rm -rf $DESTIMG # write image to SD card