From e46a3f2376eb2b663686e95ee821b1b23487366c Mon Sep 17 00:00:00 2001 From: David Holdeman Date: Sat, 25 Feb 2023 17:07:31 -0600 Subject: [PATCH] new updater script (#5132) --- .../workflows/add-ubuntu-latest-apt-mirrors.sh | 14 -------------- .github/workflows/build-android.yaml | 3 +-- .github/workflows/build-firmware.yaml | 7 ++----- .github/workflows/build-rusEFI-console.yaml | 3 +-- .github/workflows/build-simulator.yaml | 3 +-- .github/workflows/build-tsplugin-body.yaml | 3 +-- .github/workflows/build-unit-tests.yaml | 3 +-- .github/workflows/gen-configs.yaml | 3 +-- .github/workflows/gen-diffs.yaml | 3 +-- .github/workflows/gen-docs.yaml | 3 +-- .github/workflows/gen-ibom.yaml | 3 +-- .github/workflows/set-date.yaml | 3 +-- misc/actions/add-ubuntu-latest-apt-mirrors.sh | 17 +++++++++++++++++ 13 files changed, 29 insertions(+), 39 deletions(-) delete mode 100755 .github/workflows/add-ubuntu-latest-apt-mirrors.sh create mode 100644 misc/actions/add-ubuntu-latest-apt-mirrors.sh diff --git a/.github/workflows/add-ubuntu-latest-apt-mirrors.sh b/.github/workflows/add-ubuntu-latest-apt-mirrors.sh deleted file mode 100755 index 81db2c1518..0000000000 --- a/.github/workflows/add-ubuntu-latest-apt-mirrors.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -# run as root - -> /etc/apt/sources.list.d/ubuntu-latest-mirrors.list -for mirror in \ - 'http://ubuntu.osuosl.org/ubuntu/' \ - 'http://mirrors.ocf.berkeley.edu/ubuntu/' \ - ; do - cat /etc/apt/sources.list >> /etc/apt/sources.list.d/ubuntu-latest-mirrors.list - sed "s#http://azure.archive.ubuntu.com/ubuntu/#$mirror#" -i /etc/apt/sources.list.d/ubuntu-latest-mirrors.list -done - -apt-get -o Acquire::Retries=3 update diff --git a/.github/workflows/build-android.yaml b/.github/workflows/build-android.yaml index b3fc330e51..adb69d081c 100644 --- a/.github/workflows/build-android.yaml +++ b/.github/workflows/build-android.yaml @@ -23,9 +23,8 @@ jobs: java-version: '8' - name: Install Tools - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install mtools - name: Generate Configs, Enums & Live Documentation diff --git a/.github/workflows/build-firmware.yaml b/.github/workflows/build-firmware.yaml index 82fcdc71af..68c85f0e12 100644 --- a/.github/workflows/build-firmware.yaml +++ b/.github/workflows/build-firmware.yaml @@ -359,12 +359,9 @@ jobs: - name: Install multilib, mingw, sshpass and mtools if: ${{ env.skip != 'true' }} - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh - sudo apt-get install gcc-multilib g++-multilib g++-mingw-w64 gcc-mingw-w64 sshpass mtools - sudo apt-get install zip - sudo apt-get install dosfstools + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh + sudo apt-get install gcc-multilib g++-multilib g++-mingw-w64 gcc-mingw-w64 sshpass mtools zip dosfstools - name: Generate Live Documentation if: ${{ env.skip != 'true' }} diff --git a/.github/workflows/build-rusEFI-console.yaml b/.github/workflows/build-rusEFI-console.yaml index 6e160ee529..69b3cde14d 100644 --- a/.github/workflows/build-rusEFI-console.yaml +++ b/.github/workflows/build-rusEFI-console.yaml @@ -27,9 +27,8 @@ jobs: run: javac -version - name: Install Tools - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install sshpass mtools - name: Generate Configs, Enums & Live Documentation diff --git a/.github/workflows/build-simulator.yaml b/.github/workflows/build-simulator.yaml index 5b32d0706e..c32f97ccc5 100644 --- a/.github/workflows/build-simulator.yaml +++ b/.github/workflows/build-simulator.yaml @@ -29,9 +29,8 @@ jobs: run: gcc -v - name: Install multilib - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install gcc-multilib g++-multilib mtools dosfstools zip - name: Generate Configs, Enums & Live Documentation diff --git a/.github/workflows/build-tsplugin-body.yaml b/.github/workflows/build-tsplugin-body.yaml index 0315dd53f9..0cd731dc5f 100644 --- a/.github/workflows/build-tsplugin-body.yaml +++ b/.github/workflows/build-tsplugin-body.yaml @@ -18,9 +18,8 @@ jobs: run: javac -version - name: Install Tools - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install sshpass - name: Build TS plugin body diff --git a/.github/workflows/build-unit-tests.yaml b/.github/workflows/build-unit-tests.yaml index c0fa89e183..2119fb61bc 100644 --- a/.github/workflows/build-unit-tests.yaml +++ b/.github/workflows/build-unit-tests.yaml @@ -27,9 +27,8 @@ jobs: - name: Install required software (ubuntu) if: ${{ matrix.os != 'macos-latest' }} - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install mtools zip dosfstools sshpass lcov valgrind - name: Install required software (macos) diff --git a/.github/workflows/gen-configs.yaml b/.github/workflows/gen-configs.yaml index 9f381a2773..5e5d37ea2e 100644 --- a/.github/workflows/gen-configs.yaml +++ b/.github/workflows/gen-configs.yaml @@ -21,9 +21,8 @@ jobs: git submodule update --init --depth=1 firmware/controllers/can/wideband_firmware - name: Install Tools - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install sshpass sshpass mtools - name: Generate Enum Strings diff --git a/.github/workflows/gen-diffs.yaml b/.github/workflows/gen-diffs.yaml index 1e8acbc9e0..da40787c2b 100644 --- a/.github/workflows/gen-diffs.yaml +++ b/.github/workflows/gen-diffs.yaml @@ -19,9 +19,8 @@ jobs: git submodule update --init --depth=1 hardware/rusefi_lib - name: Install sshpass, kicad, and tk bindings - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo add-apt-repository --yes ppa:kicad/kicad-6.0-releases sudo apt-get install sshpass kicad python3-pip python3-tk scour librsvg2-bin pip install python-dateutil pygubu diff --git a/.github/workflows/gen-docs.yaml b/.github/workflows/gen-docs.yaml index afd0f3c234..37dfeaba5d 100644 --- a/.github/workflows/gen-docs.yaml +++ b/.github/workflows/gen-docs.yaml @@ -12,9 +12,8 @@ jobs: - uses: actions/checkout@v3 - name: Install prerequisite software - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install doxygen graphviz sshpass - name: Set FTP variables diff --git a/.github/workflows/gen-ibom.yaml b/.github/workflows/gen-ibom.yaml index 2dd49a684c..978cd95642 100644 --- a/.github/workflows/gen-ibom.yaml +++ b/.github/workflows/gen-ibom.yaml @@ -16,9 +16,8 @@ jobs: git submodule update --init --depth=1 hardware/InteractiveHtmlBom - name: Install prerequisite software - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install kicad sshpass - name: Set SSH variables diff --git a/.github/workflows/set-date.yaml b/.github/workflows/set-date.yaml index 95272a8b88..60bea25e30 100644 --- a/.github/workflows/set-date.yaml +++ b/.github/workflows/set-date.yaml @@ -26,9 +26,8 @@ jobs: - name: Install Tools if: ${{ env.skip != 'true' }} - working-directory: ./.github/workflows/ run: | - sudo ./add-ubuntu-latest-apt-mirrors.sh + sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh sudo apt-get install subversion - name: Update version header in git diff --git a/misc/actions/add-ubuntu-latest-apt-mirrors.sh b/misc/actions/add-ubuntu-latest-apt-mirrors.sh new file mode 100644 index 0000000000..b6fdd55f70 --- /dev/null +++ b/misc/actions/add-ubuntu-latest-apt-mirrors.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# run as root + +[ ! -f /etc/apt/sources.list.bak ] && cp /etc/apt/sources.list /etc/apt/sources.list.bak +for mirror in \ + 'http://azure.archive.ubuntu.com/ubuntu/' \ + 'http://ubuntu.osuosl.org/ubuntu/' \ + 'http://mirrors.ocf.berkeley.edu/ubuntu/' \ + ; do + sed "s#http:.*?(?=\s)#$mirror#" /etc/apt/sources.list.bak > /etc/apt/sources.list + if apt-get -o Acquire::Retries=3 update; then + exit 0 + fi +done +exit 1 +