Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/guysoft/OctoPi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Sheffer <guysoft@gmail.com>2020-07-05 02:01:37 +0300
committerGitHub <noreply@github.com>2020-07-05 02:01:37 +0300
commit1c7e1c242d553996b838148ba90781d7ab749f9f (patch)
treef30c12a3f094b34e4a72e3914712508aaef61a9a
parent7bde94e2544bc6f5a667db5edc13b88a43fb4bbd (diff)
parent8cf4b4100dd2f4626d6d91f7fec7cf9d76afb865 (diff)
Merge pull request #661 from guysoft/improve/image_build
Build image via Github Actions
-rw-r--r--.github/workflows/build.yml64
-rwxr-xr-xsrc/modules/octopi/config3
-rwxr-xr-xsrc/modules/octopi/start_chroot_script13
3 files changed, 80 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..41c0a0d
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,64 @@
+name: Build Image
+
+on:
+ push:
+ schedule:
+ - cron: '0 0 * * *'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Install Dependencies
+ run: |
+ sudo apt update
+ sudo apt install coreutils p7zip-full qemu-user-static
+
+ - name: Checkout CustomPiOS
+ uses: actions/checkout@v2
+ with:
+ repository: 'guysoft/CustomPiOS'
+ path: CustomPiOS
+
+ - name: Checkout Project Repository
+ uses: actions/checkout@v2
+ with:
+ path: repository
+ submodules: true
+
+ - name: Download Raspbian Image
+ run: |
+ cd repository/src/image
+ wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest'
+
+ - name: Update CustomPiOS Paths
+ run: |
+ cd repository/src
+ ../../CustomPiOS/src/update-custompios-paths
+
+ - name: Force apt mirror to work around intermittent mirror hiccups
+ run: |
+ echo "OCTOPI_APTMIRROR=http://mirror.us.leaseweb.net/raspbian/raspbian" > repository/src/config.local
+
+ - name: Build Image
+ run: |
+ sudo modprobe loop
+ cd repository/src
+ sudo bash -x ./build_dist
+
+ - name: Copy output
+ id: copy
+ run: |
+ source repository/src/config
+ NOW=$(date +"%Y-%m-%d-%H%M")
+ IMAGE=$NOW-octopi-$DIST_VERSION
+
+ cp repository/src/workspace/*.img $IMAGE.img
+
+ echo "::set-output name=image::$IMAGE"
+
+ # artifact upload will take care of zipping for us
+ - uses: actions/upload-artifact@v1
+ with:
+ name: ${{ steps.copy.outputs.image }}
+ path: ${{ steps.copy.outputs.image }}.img \ No newline at end of file
diff --git a/src/modules/octopi/config b/src/modules/octopi/config
index ade885f..996b1bc 100755
--- a/src/modules/octopi/config
+++ b/src/modules/octopi/config
@@ -34,3 +34,6 @@
[ -n "$OCTOPI_YQ_DOWNLOAD" ] || OCTOPI_YQ_DOWNLOAD=$(wget -q -O - https://api.github.com/repos/mikefarah/yq/releases/latest | grep "browser_download_url" | grep "yq_linux_arm" | cut -d : -f 2,3 | tr -d \" | tr -d ,)
[ -n "$OCTOPI_COMMIT" ] || OCTOPI_COMMIT=`pushd "${DIST_PATH}" > /dev/null ; git rev-parse HEAD ; popd > /dev/null`
+
+# Fixed apt mirror
+[ -n "$OCTOPI_APTMIRROR" ] || OCTOPI_APTMIRROR= \ No newline at end of file
diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script
index eb77a28..6b7bb68 100755
--- a/src/modules/octopi/start_chroot_script
+++ b/src/modules/octopi/start_chroot_script
@@ -11,6 +11,13 @@ export LC_ALL=C
source /common.sh
+if [ -n "$OCTOPI_APTMIRROR" ];
+then
+ echo "Switching apt mirror in /etc/apt/sources.list to $OCTOPI_APTMIRROR"
+ cp /etc/apt/sources.list /etc/apt/sources.list.backup
+ sed -i "s@http://raspbian.raspberrypi.org/raspbian/@$OCTOPI_APTMIRROR@g" /etc/apt/sources.list
+fi
+
WEBCAM_USER=webcam
### Script ####
@@ -261,3 +268,9 @@ systemctl_if_exists enable ffmpeg_hls.service
#cleanup
apt-get clean
apt-get autoremove -y
+
+if [ -n "$OCTOPI_APTMIRROR" ];
+then
+ echo "Reverting /etc/apt/sources.list"
+ mv /etc/apt/sources.list.backup /etc/apt/sources.list
+fi