Compare commits

...

54 Commits

Author SHA1 Message Date
40d6d2df03 fix(turris,omnia): reboot after disk resize
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-04-14 17:37:19 +02:00
f70763aed7 feat: use emissary v2023.4.14-813f837
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-04-14 14:32:47 +00:00
475a807302 feat: use emissary v2023.4.13-ed35ee5
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-13 11:52:10 +00:00
4e075cbd8e feat: use emissary v2023.4.13-4b5bc0b
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-13 10:11:55 +00:00
ed52367837 feat: use emissary v2023.4.13-dee6218
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-13 09:39:49 +00:00
a6c32c5315 feat: use emissary v2023.4.13-76656e8
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-13 09:32:01 +00:00
a35c5563db feat: use emissary v2023.4.13-41b1619
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-13 09:08:54 +00:00
751f5398e1 feat: use emissary v2023.4.12-35d5ee8
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-12 09:13:52 +00:00
9b2c2e5cdc feat: use emissary v2023.4.11-2315ee7
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-11 13:14:45 +00:00
2aa581e3c0 feat: use emissary v2023.4.11-86a6d81
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-11 10:09:57 +00:00
fc7be554a3 feat: use emissary v2023.4.11-8fb86c6
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-11 09:17:18 +00:00
f6df7651da feat(turris,omnia): automatically resize partition at startup
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-07 11:38:36 +02:00
87b15c940f feat: use emissary v2023.4.6-12f8b3a
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-04-06 19:00:29 +00:00
30d48ce4aa feat: use emissary v2023.4.6-4cf53d9
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 17:28:39 +00:00
2f06b5fdcf feat: use emissary v2023.4.6-47c2546
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 16:29:28 +00:00
c3070d2922 feat: use emissary v2023.4.6-2117391
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 16:21:15 +00:00
38a0d35c7b feat: use emissary v2023.4.6-b213b8d
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 14:01:51 +00:00
9a48ff1a65 feat: use emissary v2023.4.6-9dcddc5
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 13:17:58 +00:00
e1ed8f9bd1 feat: use emissary v2023.4.6-253c93d
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 09:04:09 +00:00
cec076241a feat: use emissary v2023.4.6-d2f865c
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 08:47:39 +00:00
adb3877206 feat: use emissary v2023.4.6-06b1235
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 08:26:51 +00:00
dd3bb6748c feat: use emissary v2023.4.6-06b1235-dirty
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-06 08:25:50 +00:00
d58fe78b43 feat: use emissary v2023.4.5-2e1ee44
Some checks failed
arcad/emissary-firmware/pipeline/head There was a failure building this commit
2023-04-05 21:32:38 +00:00
30e31359ec feat: use emissary v2023.4.5-2e1ee44-dirty
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-05 21:25:26 +00:00
2839b21113 feat: use emissary v2023.4.4-242a247
Some checks failed
arcad/emissary-firmware/pipeline/head There was a failure building this commit
2023-04-04 18:44:04 +00:00
b096b36e5c feat: use emissary v2023.4.4-242a247-dirty
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-04 18:30:45 +00:00
d945203a70 feat: use emissary v2023.4.2-562d698
Some checks failed
arcad/emissary-firmware/pipeline/head There was a failure building this commit
2023-04-02 16:32:38 +00:00
aff32b8627 feat: use emissary v2023.4.2-562d698-dirty
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-02 16:10:04 +00:00
f9c6997cdc feat: do not keep agent state between upgrades
Some checks failed
arcad/emissary-firmware/pipeline/head There was a failure building this commit
2023-04-01 21:24:58 +02:00
4e1772995d feat: use emissary v2023.4.1-909549f
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-04-01 17:47:38 +00:00
f58c7cc6a7 feat: use emissary v2023.4.1-7d551a8
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-01 17:34:21 +00:00
95046def13 feat: use emissary v2023.4.1-d02eb91
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-01 12:36:55 +00:00
dc26c10bb3 feat: use emissary v2023.4.1-d2bcdd2
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-04-01 11:31:55 +00:00
7fbc1930df chore: display emissary version in release body
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-03-31 17:50:33 +02:00
d65ba3f252 feat: use emissary v2023.3.31-c638fe1
All checks were successful
arcad/emissary-firmware/pipeline/head This commit looks good
2023-03-31 15:35:20 +00:00
b56e563aa0 feat: use emissary v2023.3.31-5fc5f5f
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-03-31 15:20:01 +00:00
2c701ffc16 chore: add jenkins pipeline
Some checks reported errors
arcad/emissary-firmware/pipeline/head Something is wrong with the build of this commit
2023-03-31 17:19:44 +02:00
aa22f3c55b feat: update emissary to v2023.3.29-e5b6c5e 2023-03-29 21:43:31 +02:00
f6c3de68b2 feat: use emissary v2023.3.29-351f22e 2023-03-29 17:45:27 +02:00
1470bea902 chore: filter download emissary artefacts 2023-03-29 16:05:01 +02:00
aa314a939f feat: move all emissary 'data' files to /data 2023-03-29 12:23:28 +02:00
844c5d0e17 chore: allow override of used image in flash script 2023-03-29 12:23:01 +02:00
656081568e feat(turris,omnia): use armv7 arch for emissary binary 2023-03-29 12:22:27 +02:00
b03e00fe5b feat: multiples fix 2023-03-27 19:28:58 +02:00
b4d6c75d52 feat: keep state.json and agent-key.json between upgrades 2023-03-25 16:46:00 +01:00
02db564bb0 feat: add turris omnia target 2023-03-10 11:22:03 +01:00
50025decc1 feat: differentiate machine-id generation in x86 target 2023-03-10 11:21:22 +01:00
55b49679f1 feat: use dmi data to generate machine id 2023-03-09 15:09:43 +01:00
78cffa1c12 chore: remove generated files from repo 2023-03-09 15:09:17 +01:00
7d2c56f81b fix(x86): handle missing uci dhcp.server option 2023-03-06 13:10:03 +01:00
260a9b4fae feat: add urandom seed as source for machine-id generation 2023-03-06 13:09:32 +01:00
7724b2b922 feat: add raspberry pi target 2023-03-06 12:31:45 +01:00
ead8431119 chore: refactor generic target 2023-03-06 12:31:31 +01:00
fd62e14b32 chore: use date based version 2023-03-06 12:30:57 +01:00
23 changed files with 256 additions and 147 deletions

102
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,102 @@
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
dir 'misc/jenkins'
}
}
parameters {
persistentText(name: 'emissaryRelease', defaultValue: 'latest', description: 'Numéro de release Emissary', successfulOnly: false)
}
stages {
stage('Cancel older jobs') {
steps {
script {
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
}
}
}
stage('Update emissary release') {
when {
expression {
return params.emissaryRelease != 'latest'
}
}
steps {
script {
currentEmissaryRelease = readFile('emissary_release.txt').trim()
if (currentEmissaryRelease == params.emissaryRelease) {
currentBuild.result = 'SUCCESS'
return
}
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GIT_USERNAME',
passwordVariable: 'GIT_PASSWORD'
])
]) {
sh """
git config user.email "jenkins@cadoles.com"
git config user.name "Jenkins"
git config credential.https://forge.cadoles.com.username "\$GIT_USERNAME"
git config credential.https://forge.cadoles.com.helper '!f() { test "\$1" = get && echo "password=\$GIT_PASSWORD"; }; f'
echo '${params.emissaryRelease}' > emissary_release.txt
git add emissary_release.txt
git commit -m "feat: use emissary ${params.emissaryRelease}"
git pull --rebase
git push origin \$(git rev-parse HEAD):${env.GIT_BRANCH}
"""
}
}
}
}
stage('Build and release') {
steps {
script {
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GITEA_DOWNLOAD_USERNAME',
passwordVariable: 'GITEA_DOWNLOAD_PASSWORD'
])
]) {
sh '''
make download-emissary-release
make all
'''
}
}
}
}
stage('Release') {
steps {
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GITEA_RELEASE_USERNAME',
passwordVariable: 'GITEA_RELEASE_PASSWORD'
])
]) {
sh 'make gitea-release'
}
}
}
}
post {
always {
cleanWs()
}
}
}

View File

@ -2,13 +2,15 @@ OPENWRT_DEVICE ?= 192.168.1.1
BACKUP_DATE ?= BACKUP_DATE ?=
GIT_VERSION := $(shell git describe --always) GIT_VERSION := $(shell git describe --always)
DATE_VERSION := $(shell date +%Y.%m.%d)
FULL_VERSION := v$(DATE_VERSION)-$(GIT_VERSION)
OPENWRT_VERSION ?= 22.03.2 OPENWRT_VERSION ?= 22.03.2
OPENWRT_TARGET ?= mvebu/cortexa9 OPENWRT_TARGET ?= mvebu/cortexa9
OPENWRT_TARGET_DASHED ?= $(shell echo $(OPENWRT_TARGET) | sed 's|/|-|') OPENWRT_TARGET_DASHED ?= $(shell echo $(OPENWRT_TARGET) | sed 's|/|-|')
OPENWRT_PROFILE ?= linksys_wrt1200ac OPENWRT_PROFILE ?= linksys_wrt1200ac
OPENWRT_PACKAGES ?= $(shell cat packages.txt) OPENWRT_PACKAGES ?= $(shell cat packages.txt)
EXTRA_IMAGE_NAME ?= emissary-$(GIT_VERSION) EXTRA_IMAGE_NAME ?= emissary-$(FULL_VERSION)
BIN_DIR_NAME_SUFFIX ?= BIN_DIR_NAME_SUFFIX ?=
IMAGEBUILDER_URL ?= https://downloads.openwrt.org/releases/$(OPENWRT_VERSION)/targets/$(OPENWRT_TARGET)/openwrt-imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).Linux-x86_64.tar.xz IMAGEBUILDER_URL ?= https://downloads.openwrt.org/releases/$(OPENWRT_VERSION)/targets/$(OPENWRT_TARGET)/openwrt-imagebuilder-$(OPENWRT_VERSION)-$(OPENWRT_TARGET_DASHED).Linux-x86_64.tar.xz
@ -20,7 +22,7 @@ IMAGEBUILDER_CUSTOM_FILES_DIR_PATH := $(IMAGEBUILDER_DIR_PATH)/files
BIN_DIR := "$(shell readlink -f bin)/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)/$(OPENWRT_PROFILE)$(BIN_DIR_NAME_SUFFIX)" BIN_DIR := "$(shell readlink -f bin)/$(OPENWRT_VERSION)/$(OPENWRT_TARGET)/$(OPENWRT_PROFILE)$(BIN_DIR_NAME_SUFFIX)"
GITEA_DOWNLOAD_RELEASE_NAME ?= latest EMISSARY_RELEASE ?= $(shell cat emissary_release.txt)
EMISSARY_ARCH ?= armv6 EMISSARY_ARCH ?= armv6
EMISSARY_RECONCILIATION_INTERVAL ?= EMISSARY_RECONCILIATION_INTERVAL ?=
@ -28,6 +30,7 @@ EMISSARY_SERVER_URL ?=
BASE_INSTALL ?= install-emissary-files BASE_INSTALL ?= install-emissary-files
ADDITIONAL_INSTALL ?= ADDITIONAL_INSTALL ?=
ADDITIONAL_OPENWRT_PACKAGES ?=
include targets/*.mk include targets/*.mk
include install/*.mk include install/*.mk
@ -49,7 +52,7 @@ build: $(IMAGEBUILDER_DIR_PATH) $(IMAGEBUILDER_CUSTOM_PACKAGES_DIR_PATH) $(IMAGE
-C "$(IMAGEBUILDER_DIR_PATH)" \ -C "$(IMAGEBUILDER_DIR_PATH)" \
EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \ EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
PROFILE="$(OPENWRT_PROFILE)" \ PROFILE="$(OPENWRT_PROFILE)" \
PACKAGES="$(OPENWRT_PACKAGES)" \ PACKAGES="$(OPENWRT_PACKAGES) $(ADDITIONAL_OPENWRT_PACKAGES)" \
CONFIG_IPV6=n \ CONFIG_IPV6=n \
FILES="$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)" \ FILES="$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)" \
BIN_DIR="$(BIN_DIR)" \ BIN_DIR="$(BIN_DIR)" \
@ -74,9 +77,8 @@ $(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH):
rm -rf "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)" rm -rf "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)"
mkdir -p "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc" mkdir -p "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc"
echo "# Firmware built with https://forge.cadoles.com/Cadoles/emissary-firmware" > "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware" echo "# Firmware built with https://forge.cadoles.com/arcad/emissary-firmware" > "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
echo "BUILD_DATE=$(shell date --iso-8601=seconds)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware" echo "FIRMWARE_VERSION=$(FULL_VERSION)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
echo "GIT_VERSION=$(GIT_VERSION)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
echo "OPENWRT_PROFILE=$(OPENWRT_PROFILE)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware" echo "OPENWRT_PROFILE=$(OPENWRT_PROFILE)" >> "$(IMAGEBUILDER_CUSTOM_FILES_DIR_PATH)/etc/emissary_firmware"
rm -rf files/* rm -rf files/*
@ -103,12 +105,12 @@ gitea-release: tools/gitea-release/bin/gitea-release.sh
GITEA_RELEASE_PROJECT="emissary-firmware" \ GITEA_RELEASE_PROJECT="emissary-firmware" \
GITEA_RELEASE_ORG="arcad" \ GITEA_RELEASE_ORG="arcad" \
GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \ GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \
GITEA_RELEASE_VERSION="$(GIT_VERSION)" \ GITEA_RELEASE_VERSION="$(FULL_VERSION)" \
GITEA_RELEASE_NAME="$(GIT_VERSION)" \ GITEA_RELEASE_NAME="$(FULL_VERSION)" \
GITEA_RELEASE_COMMITISH_TARGET="$(GIT_VERSION)" \ GITEA_RELEASE_COMMITISH_TARGET="$(GIT_VERSION)" \
GITEA_RELEASE_IS_DRAFT="false" \ GITEA_RELEASE_IS_DRAFT="false" \
GITEA_RELEASE_BODY="" \ GITEA_RELEASE_BODY="With Emissary $(EMISSARY_RELEASE)" \
GITEA_RELEASE_ATTACHMENTS="$(shell find .gitea-release/* -type f)" \ GITEA_RELEASE_ATTACHMENTS="$$(find .gitea-release/* -type f)" \
tools/gitea-release/bin/gitea-release.sh tools/gitea-release/bin/gitea-release.sh
.PHONY: download-emissary-release .PHONY: download-emissary-release
@ -117,7 +119,8 @@ download-emissary-release: tools/gitea-download/bin/gitea-download.sh
GITEA_DOWNLOAD_PROJECT="emissary" \ GITEA_DOWNLOAD_PROJECT="emissary" \
GITEA_DOWNLOAD_ORG="arcad" \ GITEA_DOWNLOAD_ORG="arcad" \
GITEA_DOWNLOAD_BASE_URL="https://forge.cadoles.com" \ GITEA_DOWNLOAD_BASE_URL="https://forge.cadoles.com" \
GITEA_DOWNLOAD_RELEASE_NAME="$(GITEA_DOWNLOAD_RELEASE_NAME)" \ GITEA_DOWNLOAD_RELEASE_NAME="$(EMISSARY_RELEASE)" \
GITEA_DOWNLOAD_ATTACHMENTS_FILTER="\.tar\.gz$$" \
tools/gitea-download/bin/gitea-download.sh tools/gitea-download/bin/gitea-download.sh
tools/gitea-release/bin/gitea-release.sh: tools/gitea-release/bin/gitea-release.sh:
@ -140,5 +143,5 @@ UPX_VERSION := 4.0.2
tools/upx/bin/upx: tools/upx/bin/upx:
mkdir -p tools/upx/bin mkdir -p tools/upx/bin
curl -L --output tools/upx/upx-$(UPX_VERSION)-amd64_linux.tar.xz https://github.com/upx/upx/releases/download/v$(UPX_VERSION)/upx-$(UPX_VERSION)-amd64_linux.tar.xz curl -L --output tools/upx/upx-$(UPX_VERSION)-amd64_linux.tar.xz https://github.com/upx/upx/releases/download/v$(UPX_VERSION)/upx-$(UPX_VERSION)-amd64_linux.tar.xz
cd tools/upx && tar -xJf upx-$(UPX_VERSION)-amd64_linux.tar.xz cd tools/upx && tar -xJf upx-$(UPX_VERSION)-amd64_linux.tar.xz && wait $$!
ln -s $(shell readlink -f tools/upx/upx-$(UPX_VERSION)-amd64_linux/upx) tools/upx/bin/upx $(SHELL) -c 'ln -s $$(readlink -f tools/upx/upx-$(UPX_VERSION)-amd64_linux/upx) tools/upx/bin/upx'

1
emissary_release.txt Normal file
View File

@ -0,0 +1 @@
v2023.4.14-813f837

View File

@ -1,5 +0,0 @@
package emissary
config main 'agent'
option reconciliation_interval '60'
option server_url 'https://emissary.cadol.es'

View File

@ -1,35 +0,0 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=50
STOP=50
start_service() {
config_load emissary
mkdir -p /usr/share/emissary
mkdir -p /var/lib/emissary
config_get emissary_reconciliation_interval agent 'reconciliation_interval' "60"
config_get emissary_server_url agent 'server_url' "https://emissary.cadol.es"
local config_file="/etc/emissary/agent.yml"
procd_open_instance emissary-agent
procd_set_param env EMISSARY_SERVER_URL="$emissary_server_url" EMISSARY_RECONCILIATION_INTERVAL="$emissary_reconciliation_interval"
procd_set_param command /usr/local/bin/emissary
procd_append_param command --workdir /usr/share/emissary
procd_append_param command --config "$config_file"
procd_append_param command agent run
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param file "$config_file"
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param pidfile /var/run/emissary-agent.pid
procd_close_instance
}
service_triggers()
{
# Reload service (restart) on emissary config changes
procd_add_reload_trigger "emissary"
}

View File

@ -1,30 +0,0 @@
#/bin/sh
set -e
main() {
local default_config="/etc/emissary/default.conf"
if [ ! -f "${default_config}" ]; then
exit 0
fi
source "${default_config}"
if [ ! -z "${EMISSARY_RECONCILIATION_INTERVAL}" ]; then
uci set "emissary.agent.reconciliation_interval=${EMISSARY_RECONCILIATION_INTERVAL}"
fi
if [ ! -z "${EMISSARY_SERVER_URL}" ]; then
uci set "emissary.agent.server_url=${EMISSARY_SERVER_URL}"
fi
# Commit modifications
uci commit
# Delete file
rm -f "${default_config}"
/etc/init.d/emissary-agent enable
}
main

View File

@ -1,4 +1,4 @@
install-emissary-files: install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
mkdir -p files/etc/config mkdir -p files/etc/config
cp -r misc/emissary/config/* files/etc/config/ cp -r misc/emissary/config/* files/etc/config/
@ -8,6 +8,14 @@ install-emissary-files:
mkdir -p files/etc/uci-defaults mkdir -p files/etc/uci-defaults
cp -r misc/emissary/uci-defaults/* files/etc/uci-defaults/ cp -r misc/emissary/uci-defaults/* files/etc/uci-defaults/
# Copy keep.d files
mkdir -p files/lib/upgrade/keep.d
cp -r misc/emissary/keep.d/* files/lib/upgrade/keep.d/
# Copy profile.d files
mkdir -p files/etc/profile.d
cp -r misc/emissary/profile.d/* files/etc/profile.d/
mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH) mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)
cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH) cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH)
@ -18,6 +26,11 @@ install-emissary-files:
# Patch agent config # Patch agent config
tools/yq/bin/yq -i '.agent.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.agent.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.privateKeyPath = "/data/emissary/agent-key.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.persistence.stateFile = "/data/emissary/agent-state.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.sysupgrade.firmwareVersionCommand = ["sh", "-c", "source /etc/emissary_firmware && echo \"$$FIRMWARE_VERSION\""]' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.dataDir = "/data/emissary/apps/data"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.downloadDir = "/data/emissary/apps/bundles"' files/etc/emissary/agent.yml
# Copy emissary binary # Copy emissary binary
mkdir -p files/usr/local/bin mkdir -p files/usr/local/bin
@ -25,10 +38,10 @@ install-emissary-files:
chmod +x files/usr/local/bin/emissary chmod +x files/usr/local/bin/emissary
# Set defaults # Set defaults
mkdir -p files/etc/emissary mkdir -p files/data/emissary
rm -rf files/etc/emissary/default.conf rm -rf files/data/emissary/default.conf
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/etc/emissary/default.conf echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/data/emissary/default.conf
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/etc/emissary/default.conf echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/data/emissary/default.conf
# Compress emissary binary # Compress emissary binary
tools/upx/bin/upx -9 files/usr/local/bin/emissary tools/upx/bin/upx -9 files/usr/local/bin/emissary

3
install/turris-omnia.mk Normal file
View File

@ -0,0 +1,3 @@
install-turris-omnia-uci-defaults:
mkdir -p files/etc/uci-defaults
cp misc/turris/omnia/uci-defaults/* files/etc/uci-defaults/

View File

@ -2,6 +2,6 @@ install-x86-network-config:
mkdir -p files/etc/config mkdir -p files/etc/config
cp misc/x86/uci/network files/etc/config/network cp misc/x86/uci/network files/etc/config/network
install-x86-firewall-rules: install-x86-uci-defaults:
mkdir -p files/etc/uci-defaults mkdir -p files/etc/uci-defaults
cp misc/x86/uci-defaults/99-x86-firewall-rules.sh files/etc/uci-defaults/99-x86-firewall-rules.sh cp misc/x86/uci-defaults/* files/etc/uci-defaults/

View File

@ -0,0 +1,3 @@
/etc/machine-id
/data/emissary/agent-key.json
/data/emissary/apps/data

View File

@ -0,0 +1,3 @@
#!/bin/sh
export PATH="${PATH}:/usr/local/bin"

View File

@ -3,7 +3,7 @@
set -e set -e
main() { main() {
local default_config="/etc/emissary/default.conf" local default_config="/data/emissary/default.conf"
if [ ! -f "${default_config}" ]; then if [ ! -f "${default_config}" ]; then
exit 0 exit 0

14
misc/jenkins/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM reg.cadoles.com/proxy_cache/library/ubuntu:22.04
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ARG http_proxy=
ARG https_proxy=
# Install dev environment dependencies
RUN export DEBIAN_FRONTEND=noninteractive &&\
apt-get update -y &&\
apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq gawk python3 rsync file
# Add LetsEncrypt certificates
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash

View File

@ -6,24 +6,14 @@ ssh-copy-id root@${OPENWRT_DEVICE}
TARGET_ARCH=$(ssh root@${OPENWRT_DEVICE} source /etc/os-release \&\& echo \${OPENWRT_BOARD:-\$LEDE_BOARD}) TARGET_ARCH=$(ssh root@${OPENWRT_DEVICE} source /etc/os-release \&\& echo \${OPENWRT_BOARD:-\$LEDE_BOARD})
FIRMWARE_FILE=bin/${OPENWRT_VERSION}/${TARGET_ARCH}/${OPENWRT_PROFILE}/openwrt-*-squashfs-factory.img FIRMWARE_FILENAME=${FIRMWARE_FILENAME:-openwrt-*-sysupgrade.img*}
FIRMWARE_FILE=bin/${OPENWRT_VERSION}/${TARGET_ARCH}/${OPENWRT_PROFILE}/${FIRMWARE_FILENAME}
FIRMWARE_FILE=${CUSTOM_FIRMWARE_FILE:-$FIRMWARE_FILE} FIRMWARE_FILE=${CUSTOM_FIRMWARE_FILE:-$FIRMWARE_FILE}
NOW=$(date +%Y-%m-%d)
BACKUP_FILENAME="backup_${OPENWRT_DEVICE}_${NOW}.tar.gz"
ssh root@${OPENWRT_DEVICE} \
rm -f "/tmp/${BACKUP_FILENAME}" \
\&\& sysupgrade -b "/tmp/${BACKUP_FILENAME}"
mkdir -p tmp/backups
scp "root@${OPENWRT_DEVICE}:/tmp/${BACKUP_FILENAME}" ./tmp/backups/
ssh root@${OPENWRT_DEVICE} \ ssh root@${OPENWRT_DEVICE} \
mkdir -p /tmp/firmwares \ mkdir -p /tmp/firmwares \
\&\& rm /tmp/firmwares/* \|\| exit 0; \&\& rm /tmp/firmwares/* \|\| exit 0;
scp $FIRMWARE_FILE root@${OPENWRT_DEVICE}:/tmp/firmwares/ scp $FIRMWARE_FILE root@${OPENWRT_DEVICE}:/tmp/firmwares/
ssh root@${OPENWRT_DEVICE} sysupgrade --force -p -v -n "/tmp/firmwares/$(basename $FIRMWARE_FILE)" ssh root@${OPENWRT_DEVICE} sysupgrade --force -v -u "/tmp/firmwares/$(basename $FIRMWARE_FILE)"

View File

@ -1,18 +0,0 @@
#!/bin/bash
set -o pipefail
NOW=$(date +%Y-%m-%d)
BACKUP_DATE=${BACKUP_DATE:-${NOW}}
BACKUP_FILENAME="backup_${OPENWRT_DEVICE}_${NOW}.tar.gz"
printf "%s" "Waiting for ${OPENWRT_DEVICE} ..."
while ! ping -c 1 -n -w 1 ${OPENWRT_DEVICE} &> /dev/null
do
printf "%c" "."
done
printf "\n%s\n" "Server is back online"
scp "./tmp/backups/${BACKUP_FILENAME}" root@${OPENWRT_DEVICE}:/tmp/
ssh root@${OPENWRT_DEVICE} sysupgrade -r "/tmp/${BACKUP_FILENAME}"

View File

@ -0,0 +1,25 @@
#!/bin/sh
set -eo pipefail
FLAG_FILE=/root/.disk_resized
if [ -f "$FLAG_FILE" ]; then
exit
fi
DISK=/dev/mmcblk0
PARTITION="${DISK}p2"
parted -s -a opt "$DISK" "resizepart 2 100%"
FS_SIZE="$(unsquashfs -s "$PARTITION" | grep -o 'Filesystem size [0-9]* bytes' | grep -o '[0-9][0-9]*')"
FS_OFFSET="$(expr '(' "$FS_SIZE" + 65535 ')' / 65536 '*' 65536)"
LOOP_DEVICE="$(losetup -f --show -o "$FS_OFFSET" "$PARTITION")"
e2fsck -y -f "$LOOP_DEVICE"
resize2fs "$LOOP_DEVICE"
touch "$FLAG_FILE"
reboot

View File

@ -12,13 +12,13 @@ main() {
# Accumulate data to create unique machine id # Accumulate data to create unique machine id
local mac_addresses=$(cat /sys/class/net/*/address | uniq | sort) local mac_addresses=$(cat /sys/class/net/*/address | uniq | sort)
local device_model=$(cat /sys/firmware/devicetree/base/model) local device_uuid=$(dmidecode | grep UUID)
# Ensure destination directory # Ensure destination directory
mkdir -p "$(dirname "$machine_id_file")" mkdir -p "$(dirname "$machine_id_file")"
# Generate SHA256 hash of data and save it to $machine_id_file # Generate SHA256 hash of data and save it to $machine_id_file
echo "$mac_adresses $device_model" | sha256sum | cut -d ' ' -f1 > "$machine_id_file" echo "$mac_adresses $device_uuid" | sha256sum | cut -d ' ' -f1 > "$machine_id_file"
} }
main main

View File

@ -3,6 +3,7 @@
set -e set -e
main() { main() {
# Update default firewall ruleset
uci add firewall rule uci add firewall rule
uci set firewall.@rule[-1].name='Allow SSH on WAN' uci set firewall.@rule[-1].name='Allow SSH on WAN'
uci set firewall.@rule[-1].src='wan' uci set firewall.@rule[-1].src='wan'
@ -25,15 +26,12 @@ main() {
uci set firewall.@rule[-1].target='ACCEPT' uci set firewall.@rule[-1].target='ACCEPT'
uci commit firewall uci commit firewall
service firewall restart
# Forward DNS queries to public DNS
uci -q delete dhcp.@dnsmasq[0].server
uci add_list dhcp.@dnsmasq[0].server="8.8.8.8"
uci add_list dhcp.@dnsmasq[0].server="8.8.4.4"
# Disable DNS-rebind protection
uci set dhcp.@dnsmasq[0].rebind_protection='0'
uci commit dhcp uci commit dhcp
service dnsmasq restart
reload_config
} }
main main

View File

@ -1,14 +1,15 @@
all: x86_generic all: x86-generic
x86_generic: x86-generic:
$(MAKE) \ $(MAKE) \
ADDITIONAL_INSTALL="install-x86-network-config install-x86-firewall-rules" \ ADDITIONAL_INSTALL="install-x86-network-config install-x86-uci-defaults" \
ADDITIONAL_OPENWRT_PACKAGES="dmidecode" \
OPENWRT_TARGET="x86/generic" \ OPENWRT_TARGET="x86/generic" \
EMISSARY_ARCH="386" \ EMISSARY_ARCH="386" \
OPENWRT_PROFILE="generic" \ OPENWRT_PROFILE="generic" \
build build
run_x86_generic: bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img run-x86-generic: bin/$(OPENWRT_VERSION)/x86/generic/generic/openwrt-$(OPENWRT_VERSION)-emissary-*-ext4-combined.img
qemu-system-x86_64 \ qemu-system-x86_64 \
-enable-kvm \ -enable-kvm \
-nographic \ -nographic \

24
targets/linksys-wrt.mk Normal file
View File

@ -0,0 +1,24 @@
all: linksys-wrtXXXXac
linksys-wrtXXXXac: linksys-wrt1200ac linksys-wrt1900ac linksys-wrt3200acm
linksys-wrt1200ac:
$(MAKE) \
OPENWRT_TARGET="mvebu/cortexa9" \
EMISSARY_ARCH="armv6" \
OPENWRT_PROFILE="linksys_wrt1200ac" \
build
linksys-wrt1900ac:
$(MAKE) \
OPENWRT_TARGET="mvebu/cortexa9" \
EMISSARY_ARCH="armv7" \
OPENWRT_PROFILE="linksys_wrt1900ac-v2" \
build
linksys-wrt3200acm:
$(MAKE) \
OPENWRT_TARGET="mvebu/cortexa9" \
EMISSARY_ARCH="armv7" \
OPENWRT_PROFILE="linksys_wrt3200acm" \
build

View File

@ -1,12 +0,0 @@
all: linksys-wrtXXXXac
linksys-wrtXXXXac: linksys-wrt1200ac linksys-wrt1900ac linksys-wrt3200acm
linksys-wrt1200ac:
$(MAKE) OPENWRT_TARGET="mvebu/cortexa9" EMISSARY_ARCH="armv6" OPENWRT_PROFILE="linksys_wrt1200ac" build
linksys-wrt1900ac:
$(MAKE) OPENWRT_TARGET="mvebu/cortexa9" EMISSARY_ARCH="armv6" OPENWRT_PROFILE="linksys_wrt1900ac-v2" build
linksys-wrt3200acm:
$(MAKE) OPENWRT_TARGET="mvebu/cortexa9" EMISSARY_ARCH="armv6" OPENWRT_PROFILE="linksys_wrt3200acm" build

17
targets/raspberry-pi.mk Normal file
View File

@ -0,0 +1,17 @@
all: rpi-4 rpi-3
rpi-4:
$(MAKE) \
ADDITIONAL_INSTALL="" \
OPENWRT_TARGET="bcm27xx/bcm2711" \
EMISSARY_ARCH="arm64" \
OPENWRT_PROFILE="rpi-4" \
build
rpi-3:
$(MAKE) \
ADDITIONAL_INSTALL="" \
OPENWRT_TARGET="bcm27xx/bcm2710" \
EMISSARY_ARCH="arm64" \
OPENWRT_PROFILE="rpi-3" \
build

12
targets/turris.mk Normal file
View File

@ -0,0 +1,12 @@
all: turris
turris: omnia
omnia:
$(MAKE) \
ADDITIONAL_INSTALL="install-turris-omnia-uci-defaults" \
ADDITIONAL_OPENWRT_PACKAGES="losetup squashfs-tools-unsquashfs resize2fs e2fsprogs parted" \
OPENWRT_TARGET="mvebu/cortexa9" \
EMISSARY_ARCH="armv7" \
OPENWRT_PROFILE="cznic_turris-omnia" \
build