diff --git a/.ci/build_pkgs.sh b/.ci/build_pkgs.sh old mode 100644 new mode 100755 index 59813fc..97e14b8 --- a/.ci/build_pkgs.sh +++ b/.ci/build_pkgs.sh @@ -1,8 +1,9 @@ -cd $CI_PROJECT_DIR/wireless/ -PKGS=$(ls) +#!/bin/sh cd $CI_PROJECT_DIR/build_dir +PKGS=$(ls $CI_PROJECT_DIR/wireless/) + echo "=== Found new/modified packages: $PKGS" for PKG in $PKGS ; do echo "===+ Download: $PKG" @@ -31,4 +32,4 @@ done for PKG in $PKGS ; do echo "===+ Building: $PKG" make "package/$PKG/compile" -j3 V=s -done \ No newline at end of file +done diff --git a/.ci/deploy.sh b/.ci/deploy.sh new file mode 100755 index 0000000..667e9f2 --- /dev/null +++ b/.ci/deploy.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +HOST=$1 +PKG=$2 + +scp -6 -o StrictHostKeyChecking=no $CI_PROJECT_DIR/build_dir/bin/packages/mips_24kc/wifictld/"$PKG"_*mips_24kc.ipk "root@$HOST":/tmp/"$PKG".ipk +if [ $? != 0 ]; then + echo "error on uploading pkg" + exit 1 +fi +ssh -6 -o StrictHostKeyChecking=no "root@$HOST" opkg remove $PKG +ssh -6 -o StrictHostKeyChecking=no "root@$HOST" opkg install /tmp/"$PKG".ipk diff --git a/.ci/download_sdk.sh b/.ci/download_sdk.sh old mode 100644 new mode 100755 index a63d35c..ccf8357 --- a/.ci/download_sdk.sh +++ b/.ci/download_sdk.sh @@ -1,8 +1,10 @@ -mkdir -p $CI_PROJECT_DIR/tmp -cd $CI_PROJECT_DIR/tmp +#!/bin/sh + +mkdir $CI_PROJECT_DIR/cache/ +cd $CI_PROJECT_DIR/cache/ curl "https://$SDK_HOST/$SDK_PATH/sha256sums" -sS -o sha256sums curl "https://$SDK_HOST/$SDK_PATH/sha256sums.asc" -sS -o sha256sums.asc gpg --with-fingerprint --verify sha256sums.asc sha256sums rsync -av "$SDK_HOST::downloads/$SDK_PATH/$SDK_FILE" . -sha256sum -c --ignore-missing sha256sums \ No newline at end of file +sha256sum -c --ignore-missing sha256sums diff --git a/.ci/prepare_build_dir.sh b/.ci/prepare_build_dir.sh old mode 100644 new mode 100755 index 3eb129d..7956b1c --- a/.ci/prepare_build_dir.sh +++ b/.ci/prepare_build_dir.sh @@ -1,14 +1,15 @@ -mkdir -p $CI_PROJECT_DIR/build_dir +#!/bin/sh + +mkdir $CI_PROJECT_DIR/build_dir cd $CI_PROJECT_DIR/build_dir -tar Jxf $CI_PROJECT_DIR/tmp/$SDK_FILE --strip=1 +tar Jxf $CI_PROJECT_DIR/cache/$SDK_FILE --strip=1 cat > feeds.conf < /dev/null make defconfig > /dev/null -sed -i 's/# CONFIG_BUILD_LOG is not set/CONFIG_BUILD_LOG=y/' .config \ No newline at end of file +sed -i 's/# CONFIG_BUILD_LOG is not set/CONFIG_BUILD_LOG=y/' .config diff --git a/.gitignore b/.gitignore index b2c1afc..a4ab34e 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,5 @@ Module.symvers Mkfile.old dkms.conf - -tmp/ -build_dir/ \ No newline at end of file +cache/ +build_dir/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4eb9532..7cafd18 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,22 +1,39 @@ image: openwrtorg/packages-cci variables: - SDK_HOST: "downloads.openwrt.org" - SDK_PATH: "snapshots/targets/ar71xx/generic" - SDK_FILE: "openwrt-sdk-ar71xx-generic_*.Linux-x86_64.tar.xz" - + SDK_HOST: "downloads.openwrt.org" + SDK_PATH: "releases/18.06.2/targets/ar71xx/generic" + SDK_FILE: "openwrt-sdk-*ar71xx-generic_*.Linux-x86_64.tar.xz" + stages: - - compile + - compile + - deploy compile: - stage: compile - script: - - echo "==== Download the SDK ====" - - sh .ci/download_sdk.sh - - echo "==== Prepare build_dir ====" - - sh .ci/prepare_build_dir.sh - - echo "==== build packages ====" - - sh .ci/build_pkgs.sh - artifacts: - paths: - - build_dir/bin/packages \ No newline at end of file + stage: compile + script: + - echo "==== Download the SDK ====" + - .ci/download_sdk.sh + - echo "==== Prepare build_dir ====" + - .ci/prepare_build_dir.sh + - echo "==== build packages ====" + - .ci/build_pkgs.sh + artifacts: + paths: + - build_dir/bin/packages + +deploy: + stage: deploy + only: + - master + script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - sleep 10 + - .ci/deploy.sh flur.hotoho.n.sum7.eu wifictld + - .ci/deploy.sh flur.hotoho.n.sum7.eu respondd-module-wifictld + - ssh -6 -o StrictHostKeyChecking=no "root@flur.hotoho.n.sum7.eu" /etc/init.d/gluon-respondd restart + - .ci/deploy.sh harry.hotoho.n.sum7.eu wifictld + - .ci/deploy.sh harry.hotoho.n.sum7.eu respondd-module-wifictld + - ssh -6 -o StrictHostKeyChecking=no "root@harry.hotoho.n.sum7.eu" /etc/init.d/gluon-respondd restart diff --git a/wireless/wifictld/Makefile b/wireless/wifictld/Makefile index 25e5d51..28c5c61 100644 --- a/wireless/wifictld/Makefile +++ b/wireless/wifictld/Makefile @@ -13,7 +13,7 @@ define Package/wifictld/Default SECTION:=net CATEGORY:=Network TITLE:=wireless control daemon - URL:=https://dev.sum7.eu/wifictld/wifictld + URL:=https://dev.sum7.eu/genofire/wifictld DEPENDS:=+libubus +libubox endef diff --git a/wireless/wifictld/files/etc/init.d/wifictld b/wireless/wifictld/files/etc/init.d/wifictld index fb42f08..74c202f 100644 --- a/wireless/wifictld/files/etc/init.d/wifictld +++ b/wireless/wifictld/files/etc/init.d/wifictld @@ -13,7 +13,7 @@ start_service () { procd_set_param stdout 1 procd_set_param stderr 1 procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0} - procd_set_param command "$PROG" + procd_set_param command "$PROG" --if br-wan --mif br-wan procd_set_param watch network.wireless procd_close_instance }