add docker as builder
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,7 @@ | |||||||
| build | build | ||||||
| dl | dl | ||||||
| ib | ib | ||||||
|  | ib_x86_64 | ||||||
|  | ib_rk35xx | ||||||
|  | ib_rk33xx | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,2 +1,4 @@ | |||||||
| # istoreos-intl-builder | # iStoreNAS | ||||||
| Github Actions ImageBuilder istoreos intl |  | ||||||
|  | Define a system base iStoreOS by yourself. | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | FROM debian:buster | ||||||
|  |  | ||||||
|  | COPY sources.list /etc/apt/sources.list | ||||||
|  |  | ||||||
|  | RUN apt-get update &&\ | ||||||
|  |     apt-get install -y \ | ||||||
|  |         sudo time git-core subversion build-essential g++ bash make \ | ||||||
|  |         libssl-dev patch libncurses5 libncurses5-dev zlib1g-dev gawk \ | ||||||
|  |         flex gettext wget unzip bzip2 xz-utils device-tree-compiler python python-distutils-extra \ | ||||||
|  |         python3 python3-distutils-extra python3-setuptools swig rsync curl \ | ||||||
|  |         libsnmp-dev liblzma-dev libpam0g-dev cpio rsync gcc-multilib && \ | ||||||
|  |     apt-get clean && \ | ||||||
|  |     useradd -m builder && \ | ||||||
|  |     echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/builder | ||||||
|  |  | ||||||
|  | # set system wide dummy git config | ||||||
|  | RUN git config --system user.name "builder" && git config --system user.email "builder@example.com" | ||||||
|  |  | ||||||
|  | USER builder | ||||||
|  |  | ||||||
|  | VOLUME /work | ||||||
|  | VOLUME /work/ib | ||||||
|  |  | ||||||
|  | ENV WORK_SOURCE=/work | ||||||
|  | ENV WORK_TARGET=x86_64 | ||||||
|  |  | ||||||
|  | COPY build.sh /bin/build.sh | ||||||
|  |  | ||||||
|  | WORKDIR /work | ||||||
|  |  | ||||||
|  | ENTRYPOINT [ "/bin/build.sh" ] | ||||||
|  |  | ||||||
							
								
								
									
										77
									
								
								docker/build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										77
									
								
								docker/build.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,77 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | case ${WORK_TARGET} in | ||||||
|  |   x86_64) | ||||||
|  |     ;; | ||||||
|  |   rk35xx) | ||||||
|  |     ;; | ||||||
|  |   rk33xx) | ||||||
|  |     ;; | ||||||
|  |   *) | ||||||
|  |     echo "not supported" | ||||||
|  |     exit 1 | ||||||
|  |     ;; | ||||||
|  | esac | ||||||
|  |  | ||||||
|  | source env/${WORK_TARGET}.env | ||||||
|  |  | ||||||
|  | IB_FOUND=0 | ||||||
|  | if grep -q istore_nas ib/repositories.conf; then | ||||||
|  |     IB_FOUND=1 | ||||||
|  | else | ||||||
|  |     IB_FOUND=0 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | set -e | ||||||
|  | if [ "$IB_FOUND" = "0" ]; then | ||||||
|  |     if [ ! -f dl/${IB_NAME}.tar.xz ]; then | ||||||
|  |         wget -O dl/${IB_NAME}.tar.xz ${IB_URL}${IB_NAME}.tar.xz | ||||||
|  |         wget -O dl/sha256sums ${IB_URL}sha256sums | ||||||
|  |         [ -s dl/sha256sums ] | ||||||
|  |         [ -s dl/${IB_NAME}.tar.xz ] | ||||||
|  |         grep -Fq ${IB_NAME}.tar.xz dl/sha256sums | ||||||
|  |         cd dl && sha256sum -c --ignore-missing --status sha256sums | ||||||
|  |     fi | ||||||
|  |  | ||||||
|  |     cd ${WORK_SOURCE} | ||||||
|  |     tar -C ib --strip-components=1 -xJf dl/${IB_NAME}.tar.xz | ||||||
|  |     cp -a src/* ib/ | ||||||
|  |     ls patches/ | sort | xargs -n1 sh -c 'patch -p1 -d ib -i ../patches/$0' | ||||||
|  |     sed -i 's/ unofficial/ oversea/' ib/Makefile | ||||||
|  |     ls packages/all | cut -d "_" -f 1 | xargs -n1 sh -c 'rm ib/packages/$0*.ipk' | ||||||
|  |     cp packages/all/*.ipk ib/packages/ | ||||||
|  |     mkdir -p ib/files | ||||||
|  |     cp -a files/all/* ib/files | ||||||
|  |     case ${WORK_TARGET} in | ||||||
|  |       *x86*) | ||||||
|  |           cp src/repositories_x86_64.conf ib/repositories.conf | ||||||
|  |           cp src/target_x86_64.manifest ib/target.manifest | ||||||
|  |         ;; | ||||||
|  |       *rk35xx*) | ||||||
|  |           cp src/repositories_aarch64.conf ib/repositories.conf | ||||||
|  |           cp src/target_rk35xx.manifest ib/target.manifest | ||||||
|  |         ;; | ||||||
|  |       *rk33xx*) | ||||||
|  |           cp src/repositories_aarch64.conf ib/repositories.conf | ||||||
|  |           cp src/target_rk33xx.manifest ib/target.manifest | ||||||
|  |         ;; | ||||||
|  |       *bcm2711*) | ||||||
|  |           cp src/repositories_aarch64.conf ib/repositories.conf | ||||||
|  |           cp src/target_bcm2711.manifest ib/target.manifest | ||||||
|  |         ;; | ||||||
|  |     esac | ||||||
|  | fi | ||||||
|  | set +e | ||||||
|  |  | ||||||
|  | cd ${WORK_SOURCE}/ib | ||||||
|  |  | ||||||
|  | case $1 in | ||||||
|  |   Pack) | ||||||
|  |     make -f release.mk IB=1 | ||||||
|  |     make -f multi.mk release_env | ||||||
|  |     ;; | ||||||
|  |   *) | ||||||
|  |     make -f multi.mk image_multi FILES="files" | ||||||
|  |     ;; | ||||||
|  | esac | ||||||
|  |  | ||||||
							
								
								
									
										9
									
								
								docker/sources.list
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								docker/sources.list
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | deb http://mirrors.aliyun.com/debian/ buster main non-free contrib | ||||||
|  | deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib | ||||||
|  | deb http://mirrors.aliyun.com/debian-security buster/updates main | ||||||
|  | deb-src http://mirrors.aliyun.com/debian-security buster/updates main | ||||||
|  | deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib | ||||||
|  | deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib | ||||||
|  | deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib | ||||||
|  | deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user