mirror of
https://github.com/antos-rde/antos.git
synced 2024-11-08 06:28:25 +01:00
feat: add building system based on make
This commit is contained in:
parent
c394fb7524
commit
883fbe4190
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
build
|
125
Makefile
Normal file
125
Makefile
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
|
||||||
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
|
PLATFORM?=x86_64
|
||||||
|
|
||||||
|
RUSTUP_HOME?=/opt/rust
|
||||||
|
CARGO_HOME?=/opt/rust/cargo
|
||||||
|
RUST_TARGET?=x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
DESTDIR?=$(ROOT_DIR)/build/
|
||||||
|
BUILD_PREFIX:=$(DESTDIR)/opt/www
|
||||||
|
|
||||||
|
VERSION?=2.0.0
|
||||||
|
BRANCH?=b
|
||||||
|
BUILDID=$(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
VERSION_STR=$(VERSION)-$(BRANCH)-$(BUILDID)
|
||||||
|
PKG_NAME="AntOS_${VERSION_STR}_${PLATFORM}"
|
||||||
|
|
||||||
|
all: antos deb tar.gz appimg
|
||||||
|
|
||||||
|
antos: antd backend frontend
|
||||||
|
|
||||||
|
antd: httpd plugins luasec luasocket silk luafcgi
|
||||||
|
rm $(BUILD_PREFIX)/runner.ini
|
||||||
|
cp $(ROOT_DIR)/config/*.ini $(BUILD_PREFIX)/etc
|
||||||
|
@echo "Finish building Antd server"
|
||||||
|
|
||||||
|
httpd:
|
||||||
|
cd $(ROOT_DIR)/antd/ant-http && libtoolize && aclocal && autoconf && automake --add-missing
|
||||||
|
cd $(ROOT_DIR)/antd/ant-http && ./configure --prefix=$(BUILD_PREFIX)
|
||||||
|
make -C $(ROOT_DIR)/antd/ant-http install
|
||||||
|
|
||||||
|
plugins: antd-fcgi-plugin antd-tunnel-plugin antd-wvnc-plugin antd-tunnel-publishers
|
||||||
|
@echo "Finish making plugins"
|
||||||
|
|
||||||
|
luasec:
|
||||||
|
@echo "Building $@"
|
||||||
|
lua5.3 $(ROOT_DIR)/antd/luasec/src/options.lua -g \
|
||||||
|
/usr/include/openssl/ssl.h \
|
||||||
|
> $(ROOT_DIR)/antd/luasec/src/options.c
|
||||||
|
INC_PATH=-I$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
||||||
|
make -C $(ROOT_DIR)/antd/luasec linux
|
||||||
|
INC_PATH=-I$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
||||||
|
DESTDIR=$(DESTDIR) \
|
||||||
|
LUAPATH=/opt/www/lib/lua \
|
||||||
|
LUACPATH=/opt/www/lib/lua \
|
||||||
|
make -C $(ROOT_DIR)/antd/luasec install
|
||||||
|
|
||||||
|
luasocket:
|
||||||
|
@echo "Building $@"
|
||||||
|
LUAV=5.4 \
|
||||||
|
LUAINC_linux=$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
||||||
|
LUAPREFIX_linux=$(DESTDIR) \
|
||||||
|
PLAT=linux \
|
||||||
|
make -C $(ROOT_DIR)/antd/luasocket linux
|
||||||
|
LUAV=5.4 \
|
||||||
|
LUAINC_linux=$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
||||||
|
LUAPREFIX_linux=$(DESTDIR) \
|
||||||
|
PLAT=linux \
|
||||||
|
make -C $(ROOT_DIR)/antd/luasocket install-unix
|
||||||
|
-mkdir -p $(DESTDIR)/lib/lua
|
||||||
|
cp -rf $(DESTDIR)/lib/lua/5.4/* $(DESTDIR)/opt/www/lib/lua/
|
||||||
|
cp -rf $(DESTDIR)/share/lua/5.4/* $(DESTDIR)/opt/www/lib/lua/
|
||||||
|
rm -rf $(DESTDIR)/lib $(DESTDIR)/share
|
||||||
|
|
||||||
|
antd-% sil%: httpd
|
||||||
|
@echo "Building $@"
|
||||||
|
cd $(ROOT_DIR)/antd/$@ && libtoolize && aclocal && autoconf && automake --add-missing
|
||||||
|
cd $(ROOT_DIR)/antd/$@ && CFLAGS="-I$(BUILD_PREFIX)/include" LDFLAGS="-L$(BUILD_PREFIX)/lib" ./configure --prefix=$(BUILD_PREFIX)
|
||||||
|
make -C $(ROOT_DIR)/antd/$@ install
|
||||||
|
|
||||||
|
luafcgi:
|
||||||
|
ifeq ($(LUAFCGI_IGNORE),)
|
||||||
|
@echo "Building $@"
|
||||||
|
RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \
|
||||||
|
. $(CARGO_HOME)/env && \
|
||||||
|
rustup default stable && \
|
||||||
|
rustup target add $(RUST_TARGET) && \
|
||||||
|
cargo build --target=$(RUST_TARGET) --release \
|
||||||
|
--manifest-path=$(ROOT_DIR)/antd/luafcgi/Cargo.toml
|
||||||
|
install -m 0755 $(ROOT_DIR)/antd/luafcgi/target/$(RUST_TARGET)/release/luad $(BUILD_PREFIX)/bin
|
||||||
|
else
|
||||||
|
@echo "Ignore building $@"
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Clean all target"
|
||||||
|
make -C antd/ant-http clean
|
||||||
|
make -C antd/antd-fcgi-plugin clean
|
||||||
|
make -C antd/antd-tunnel-plugin clean
|
||||||
|
make -C antd/antd-wvnc-plugin clean
|
||||||
|
make -C antd/antd-tunnel-publishers clean
|
||||||
|
make -C antd/luasec clean
|
||||||
|
make -C antd/luasocket clean
|
||||||
|
make -C antd/silk clean
|
||||||
|
RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \
|
||||||
|
. $(CARGO_HOME)/env && cargo clean --manifest-path=$(ROOT_DIR)/antd/luafcgi/Cargo.toml
|
||||||
|
-rm -rf $(DESTDIR)/*
|
||||||
|
|
||||||
|
backend:
|
||||||
|
@echo "Building $@"
|
||||||
|
DESTDIR=$(BUILD_PREFIX)/htdocs/os make -C antos-backend
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
ifeq ($(FRONTEND_IGNORE),)
|
||||||
|
@echo "Building $@"
|
||||||
|
BUILDDIR=$(BUILD_PREFIX)/htdocs/os make -C antos-frontend install_dev release
|
||||||
|
else
|
||||||
|
@echo "Ignore building $@"
|
||||||
|
endif
|
||||||
|
|
||||||
|
deb: antos
|
||||||
|
-rm $(DESTDIR)/*.deb
|
||||||
|
scripts/mkdeb.sh $(VERSION_STR) $(PLATFORM) $(DESTDIR)
|
||||||
|
|
||||||
|
tar.gz: antos
|
||||||
|
-rm $(DESTDIR)/$(PKG_NAME).tar.gz
|
||||||
|
cd $(DESTDIR)/ && tar cvzf $(PKG_NAME).tar.gz opt
|
||||||
|
|
||||||
|
appimg: antos
|
||||||
|
-rm $(DESTDIR)/*.AppImage
|
||||||
|
scripts/mkappimg.sh $(PLATFORM) $(VERSION_STR) $(DESTDIR) $(ROOT_DIR)/antos-64.png
|
||||||
|
|
||||||
|
.PHONY: antd antos
|
47
README.md
47
README.md
@ -1 +1,46 @@
|
|||||||
# antos
|
# AntOS
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
### Build dependencies
|
||||||
|
|
||||||
|
```
|
||||||
|
build-essential \
|
||||||
|
make \
|
||||||
|
libsqlite3-dev \
|
||||||
|
cmake \
|
||||||
|
zlib1g-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
libssl-dev \
|
||||||
|
autotools-dev \
|
||||||
|
autoconf \
|
||||||
|
libtool \
|
||||||
|
automake \
|
||||||
|
libffi-dev \
|
||||||
|
ca-certificates \
|
||||||
|
unzip \
|
||||||
|
libjpeg-turbo8-dev \
|
||||||
|
libvncserver-dev \
|
||||||
|
lua5.3 \
|
||||||
|
nodejs npm \
|
||||||
|
git wget curl
|
||||||
|
```
|
||||||
|
Optional for appImage
|
||||||
|
|
||||||
|
```
|
||||||
|
wget libfuse2 fuse3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Runtime dependencies
|
||||||
|
```
|
||||||
|
libssl libsqlite3 zlib1g libreadline libvncclient1 libjpeg-turbo8
|
||||||
|
```
|
||||||
|
## Build
|
||||||
|
```
|
||||||
|
git submodule update --init
|
||||||
|
make
|
||||||
|
|
||||||
|
# build docker (WIP)
|
||||||
|
make docker
|
||||||
|
|
||||||
|
```
|
@ -1 +1 @@
|
|||||||
Subproject commit 375989acbe0e85d69471f778739902b0c55214b3
|
Subproject commit 32552ee0ed78fd76b8c8524280d3d07d9f3d1ab7
|
@ -1 +1 @@
|
|||||||
Subproject commit b80bb1c0abc6aa9304dcd0a1cc882fe70f9a61bc
|
Subproject commit 32bd62ae865bfe730e940ca02fdebd92b8ab7090
|
@ -1 +1 @@
|
|||||||
Subproject commit e47cb4293f2fbbf64af346a8489e5737e7d29b3b
|
Subproject commit 813792885171de1fda208b50c9ed24686acd471d
|
58
config/antd-config.ini
Normal file
58
config/antd-config.ini
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
[SERVER]
|
||||||
|
plugins=/opt/www/lib/
|
||||||
|
plugins_ext=.so
|
||||||
|
database=/opt/www/database/
|
||||||
|
tmpdir=/tmp/
|
||||||
|
maxcon=500
|
||||||
|
backlog=5000
|
||||||
|
workers = 4
|
||||||
|
max_upload_size = 20000000
|
||||||
|
gzip_enable = 1
|
||||||
|
gzip_types = text\/.*,.*\/css.*,.*\/json.*,.*\/javascript.*
|
||||||
|
|
||||||
|
[PORT:80]
|
||||||
|
plugins = fcgi,tunnel,wvnc
|
||||||
|
htdocs=/opt/www/htdocs
|
||||||
|
ssl.enable=0
|
||||||
|
^/os/(.*)$ = /os/router.lua?r=<1>&<query>
|
||||||
|
|
||||||
|
|
||||||
|
[MIMES]
|
||||||
|
image/bmp=bmp
|
||||||
|
image/jpeg=jpg,jpeg
|
||||||
|
text/css=css
|
||||||
|
text/markdown=md
|
||||||
|
text/csv=csv
|
||||||
|
application/pdf=pdf
|
||||||
|
image/gif=gif
|
||||||
|
text/html=html,htm,chtml
|
||||||
|
application/json=json
|
||||||
|
application/javascript=js
|
||||||
|
image/png=png
|
||||||
|
image/x-portable-pixmap=ppm
|
||||||
|
application/x-rar-compressed=rar
|
||||||
|
image/tiff=tiff
|
||||||
|
application/x-tar=tar
|
||||||
|
text/plain=txt
|
||||||
|
application/x-font-ttf=ttf
|
||||||
|
application/xhtml+xml=xhtml
|
||||||
|
application/xml=xml
|
||||||
|
application/zip=zip
|
||||||
|
image/svg+xml=svg
|
||||||
|
application/vnd.ms-fontobject=eot
|
||||||
|
application/x-font-woff=woff,woff2
|
||||||
|
application/x-font-otf=otf
|
||||||
|
audio/mpeg=mp3,mpeg
|
||||||
|
|
||||||
|
|
||||||
|
[PLUGIN:fcgi]
|
||||||
|
name = fcgi
|
||||||
|
autoload = 1
|
||||||
|
file_type = lua
|
||||||
|
bin = /opt/www/bin/luad
|
||||||
|
socket = unix:/tmp/fcgi.sock
|
||||||
|
|
||||||
|
[PLUGIN:tunnel]
|
||||||
|
autoload = 1
|
||||||
|
name = tunnel
|
||||||
|
hotlines = unix:/var/antd_hotline.sock
|
13
config/runner.ini
Normal file
13
config/runner.ini
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[vterm]
|
||||||
|
exec = /opt/www/bin/vterm
|
||||||
|
param = unix:/var/antd_hotline.sock
|
||||||
|
debug = 0
|
||||||
|
|
||||||
|
# used only by tunnel to authentificate user
|
||||||
|
[tunnel_keychain]
|
||||||
|
exec = /opt/www/bin/wfifo
|
||||||
|
param = unix:/var/antd_hotline.sock
|
||||||
|
param = keychain
|
||||||
|
param = /tmp/antunnel_keychain
|
||||||
|
param = r
|
||||||
|
debug = 1
|
85
docker/antos/Dockerfile
Normal file
85
docker/antos/Dockerfile
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
FROM ubuntu:jammy AS deploy-env
|
||||||
|
ARG tag
|
||||||
|
COPY deps/ /
|
||||||
|
|
||||||
|
RUN dpkg -i /libssl1.1_1.1.1f-$(uname -m).deb
|
||||||
|
# manual install libssl1.1
|
||||||
|
RUN apt-get update && apt-get --yes --no-install-recommends install libsqlite3-0 zlib1g libreadline8 wget libvncclient1 libjpeg-turbo8 openssh-client tar tree
|
||||||
|
RUN apt clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN mkdir /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libsqlite3*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libreadline*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libncurse*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libz*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libcrypt*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libdl*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libm*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libpthread*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libssl*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libc*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libgcc*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/ld*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libpcre*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libuuid*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libidn2*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libpsl*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libunistring*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libjpeg*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libvncclient*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/librt*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libstdc*.so* /ulib
|
||||||
|
|
||||||
|
# vnc client support
|
||||||
|
RUN cp -rf /lib/*-linux-*/libgcrypt*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libsasl2*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/liblzo2*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libgnutls*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libgpg-error*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libp11-kit*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libtasn1*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libnettle*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libhogweed*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libgmp*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libffi*.so* /ulib
|
||||||
|
|
||||||
|
# sshclient
|
||||||
|
RUN cp -rf /lib/*-linux-*/libselinux*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libresolv*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libgssapi_krb5*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libkrb5*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libk5crypto*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libcom_err*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libkrb5support*.so* /ulib
|
||||||
|
RUN cp -rf /lib/*-linux-*/libkeyutils*.so* /ulib
|
||||||
|
|
||||||
|
|
||||||
|
# antos
|
||||||
|
RUN mkdir /platform
|
||||||
|
COPY antos-release/ /
|
||||||
|
RUN tar -xzf /build/$tag/AntOS_$(uname -m).tar.gz -C /platform/
|
||||||
|
RUN chown -R root:root /platform
|
||||||
|
RUN tree /platform
|
||||||
|
RUN ls -al /platform
|
||||||
|
|
||||||
|
FROM busybox:stable-glibc
|
||||||
|
#copy all necessary libraries
|
||||||
|
COPY --from=deploy-env /ulib/ /lib/
|
||||||
|
COPY --from=deploy-env /bin/wget /bin/
|
||||||
|
COPY --from=deploy-env /usr/bin/ssh /bin/
|
||||||
|
COPY --from=deploy-env /usr/bin/ssh-keygen /bin/
|
||||||
|
COPY --from=deploy-env /usr/bin/ssh-copy-id /bin/
|
||||||
|
COPY bash /bin/bash
|
||||||
|
COPY profile /etc/profile
|
||||||
|
RUN chmod a+x /bin/bash
|
||||||
|
# copy backend
|
||||||
|
COPY --from=deploy-env /platform/ /
|
||||||
|
# copy frontend
|
||||||
|
COPY antd-config.ini /opt/www/antd-config.ini
|
||||||
|
COPY runner.ini /opt/www/runner.ini
|
||||||
|
RUN chmod 744 /opt/www/antd-config.ini
|
||||||
|
RUN chmod 744 /opt/www/runner.ini
|
||||||
|
|
||||||
|
COPY start.sh /start.sh
|
||||||
|
RUN chmod 700 /start.sh
|
||||||
|
# start the entry point
|
||||||
|
ENTRYPOINT /start.sh
|
27
docker/dev/Dockerfile
Normal file
27
docker/dev/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
FROM ubuntu:jammy AS deploy-env
|
||||||
|
|
||||||
|
# manual install libssl1.1
|
||||||
|
RUN apt-get update && apt-get --yes --no-install-recommends install \
|
||||||
|
build-essential \
|
||||||
|
make \
|
||||||
|
libsqlite3-dev \
|
||||||
|
cmake \
|
||||||
|
zlib1g-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
libssl-dev \
|
||||||
|
autotools-dev \
|
||||||
|
autoconf \
|
||||||
|
libtool \
|
||||||
|
curl \
|
||||||
|
automake \
|
||||||
|
libffi-dev \
|
||||||
|
ca-certificates \
|
||||||
|
unzip \
|
||||||
|
libjpeg-turbo8-dev \
|
||||||
|
libvncserver-dev \
|
||||||
|
lua5.3
|
||||||
|
|
||||||
|
RUN RUSTUP_HOME=/opt/rust/rustup CARGO_HOME=/opt/rust/cargo bash -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y'
|
||||||
|
RUN chmod -R 777 /opt/rust/
|
||||||
|
RUN apt-get update && apt-get --yes --no-install-recommends install \
|
||||||
|
nodejs npm git wget libfuse2 fuse3
|
191
scripts/mkappimg.sh
Executable file
191
scripts/mkappimg.sh
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
arch=$1
|
||||||
|
tag=$2
|
||||||
|
DIR=$3
|
||||||
|
logo=$4
|
||||||
|
[ -z $arch ] && echo "1. No architecture provided" && exit 1
|
||||||
|
[ -z $tag ] && echo "2. No version provided" && exit 1
|
||||||
|
[ -z $DIR ] && echo "3. No input dir provided" && exit 1
|
||||||
|
[ -z $logo ] && echo "4. No logo file provided" && exit 1
|
||||||
|
# download the appimagetools
|
||||||
|
echo "Downloading the appimage tools"
|
||||||
|
archname=x86_64
|
||||||
|
case $arch in
|
||||||
|
amd64|x86_64)
|
||||||
|
archname=x86_64
|
||||||
|
suffix=x86_64
|
||||||
|
;;
|
||||||
|
aarch64|arm64)
|
||||||
|
archname=aarch64
|
||||||
|
suffix=aarch64
|
||||||
|
;;
|
||||||
|
armv7l|arm)
|
||||||
|
archname=armhf
|
||||||
|
suffix=armv7l
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unkown architecture"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
APP_IMG="/tmp/appimagetool.AppImage"
|
||||||
|
APP_RUNT="/tmp/runtime-$archname"
|
||||||
|
APP_DIR="/tmp/antos.AppDir"
|
||||||
|
NAME="AntOS_${tag}_${archname}"
|
||||||
|
[ -f "$APP_IMG" ] || wget --no-check-certificate -O $APP_IMG https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||||
|
chmod +x $APP_IMG
|
||||||
|
[ -f "$APP_RUNT" ] || wget -O $APP_RUNT --no-check-certificate https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-$archname
|
||||||
|
|
||||||
|
|
||||||
|
[ -d "$APP_DIR" ] && rm -rf "$APP_DIR"
|
||||||
|
|
||||||
|
echo "Building app image for $arch"
|
||||||
|
|
||||||
|
mkdir -p "$APP_DIR"
|
||||||
|
|
||||||
|
cp -rf $DIR/opt "$APP_DIR"
|
||||||
|
rm -rf $APP_DIR/opt/www/include || true
|
||||||
|
rm -rf $APP_DIR/opt/www/etc/* || true
|
||||||
|
|
||||||
|
# antd-config
|
||||||
|
cat << "EOF" >> $APP_DIR/opt/www/etc/antd-config.ini
|
||||||
|
[SERVER]
|
||||||
|
# DONOT edit following options
|
||||||
|
plugins=./opt/www/lib/
|
||||||
|
plugins_ext=.so
|
||||||
|
# These options can be changed
|
||||||
|
tmpdir=/tmp/
|
||||||
|
database=/tmp/antos_db/
|
||||||
|
maxcon=500
|
||||||
|
backlog=5000
|
||||||
|
workers = 4
|
||||||
|
max_upload_size = 20000000
|
||||||
|
gzip_enable = 1
|
||||||
|
gzip_types = text\/.*,.*\/css.*,.*\/json.*,.*\/javascript.*
|
||||||
|
debug_enable = 0
|
||||||
|
# if SSL is enable on one port, one should specify
|
||||||
|
# the SSL cert and key files
|
||||||
|
# Example: self signed key
|
||||||
|
# openssl genrsa -des3 -passout pass:1234 -out keypair.key 2048
|
||||||
|
# openssl rsa -passin pass:1234 -in keypair.key -out server.key
|
||||||
|
# openssl req -new -key server.key -out server.csr
|
||||||
|
# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
|
||||||
|
# ssl.cert=/opt/www/server.crt
|
||||||
|
# ssl.key=/opt/www/server.key
|
||||||
|
# ssl.cipher=ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
|
||||||
|
|
||||||
|
[PORT:8888]
|
||||||
|
plugins = fcgi,tunnel,wvnc
|
||||||
|
# DONOT edit this option
|
||||||
|
htdocs=./opt/www/htdocs
|
||||||
|
# Edit this option to enable SSL
|
||||||
|
ssl.enable=0
|
||||||
|
; other config shoud be rules applied on this port
|
||||||
|
; For example the following rule will
|
||||||
|
; convert a request of type:
|
||||||
|
; name.example.com?rq=1
|
||||||
|
;TO:
|
||||||
|
; example.com/name/?rq=1
|
||||||
|
; this is helpful to redirect many sub domains
|
||||||
|
; to a sub folder of the same server
|
||||||
|
; ^([a-zA-Z][a-zA-Z0-9]*)\.[a-zA-Z0-9]+\..*$ = /<1><url>?<query>
|
||||||
|
; Sytax: [regular expression on the original request]=[new request rule]
|
||||||
|
^/os/(.*)$ = /os/router.lua?r=<1>&<query>
|
||||||
|
|
||||||
|
|
||||||
|
[MIMES]
|
||||||
|
image/bmp=bmp
|
||||||
|
image/jpeg=jpg,jpeg
|
||||||
|
text/css=css
|
||||||
|
text/markdown=md
|
||||||
|
text/csv=csv
|
||||||
|
application/pdf=pdf
|
||||||
|
image/gif=gif
|
||||||
|
text/html=html,htm,chtml
|
||||||
|
application/json=json
|
||||||
|
application/javascript=js
|
||||||
|
image/png=png
|
||||||
|
image/x-portable-pixmap=ppm
|
||||||
|
application/x-rar-compressed=rar
|
||||||
|
image/tiff=tiff
|
||||||
|
application/x-tar=tar
|
||||||
|
text/plain=txt
|
||||||
|
application/x-font-ttf=ttf
|
||||||
|
application/xhtml+xml=xhtml
|
||||||
|
application/xml=xml
|
||||||
|
application/zip=zip
|
||||||
|
image/svg+xml=svg
|
||||||
|
application/vnd.ms-fontobject=eot
|
||||||
|
application/x-font-woff=woff,woff2
|
||||||
|
application/x-font-otf=otf
|
||||||
|
audio/mpeg=mp3,mpeg
|
||||||
|
|
||||||
|
[PLUGIN:fcgi]
|
||||||
|
name = fcgi
|
||||||
|
autoload = 1
|
||||||
|
file_type = lua
|
||||||
|
bin = ./opt/www/bin/luad
|
||||||
|
socket = unix:/tmp/fcgi.sock
|
||||||
|
|
||||||
|
[PLUGIN:tunnel]
|
||||||
|
autoload = 1
|
||||||
|
name = tunnel
|
||||||
|
hotlines = unix:/tmp/antd_hotline.sock
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# runner
|
||||||
|
cat << "EOF" >> $APP_DIR/opt/www/etc/runner.ini
|
||||||
|
[vterm]
|
||||||
|
# Do not change these 2 options
|
||||||
|
exec = ./opt/www/bin/vterm
|
||||||
|
param = unix:/tmp/antd_hotline.sock
|
||||||
|
# change this to enable debug
|
||||||
|
debug = 0
|
||||||
|
|
||||||
|
# used only by tunnel to authentificate user
|
||||||
|
[tunnel_keychain]
|
||||||
|
exec = ./opt/www/bin/wfifo
|
||||||
|
param = unix:/tmp/antd_hotline.sock
|
||||||
|
param = keychain
|
||||||
|
param = /tmp/antunnel_keychain
|
||||||
|
param = r
|
||||||
|
debug = 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# AppRun
|
||||||
|
cat << "EOF" >> $APP_DIR/AppRun
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
echo "Runing AntOS"
|
||||||
|
W=$(realpath $1)
|
||||||
|
B=$(dirname $0)
|
||||||
|
cd $B
|
||||||
|
[ ! -d "$W" ] && echo "$W is not a directory" && exit 1
|
||||||
|
# start antd-tunnel service
|
||||||
|
if [ ! -f "$W/antd-config.ini" ]; then
|
||||||
|
cp ./opt/www/etc/antd-config.ini $W/antd-config.ini
|
||||||
|
fi
|
||||||
|
[ ! -f "$W/runner.ini" ] && cp ./opt/www/etc/runner.ini $W/runner.ini
|
||||||
|
export LD_LIBRARY_PATH="$B/opt/www/lib/"
|
||||||
|
echo "Runing Antd in $B with configuration $W/antd-config.ini"
|
||||||
|
./opt/www/bin/antd $W/antd-config.ini >/dev/null 2>&1 | ( sleep 2 && ./opt/www/bin/runner $W/runner.ini >/dev/null 2>&1 &)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x $APP_DIR/AppRun
|
||||||
|
# desktop file
|
||||||
|
cat << "EOF" >> $APP_DIR/antos.desktop
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=AntOS
|
||||||
|
Exec=antd
|
||||||
|
Icon=antos
|
||||||
|
Type=Application
|
||||||
|
Categories=Utility;
|
||||||
|
Terminal=true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cp $logo $APP_DIR/antos.png
|
||||||
|
|
||||||
|
$APP_IMG --runtime-file $APP_RUNT $APP_DIR $DIR/$NAME.AppImage
|
64
scripts/mkdeb.sh
Executable file
64
scripts/mkdeb.sh
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
TAG=$1
|
||||||
|
ARCH=$2
|
||||||
|
DIR=$3
|
||||||
|
|
||||||
|
[ -z "$TAG" ] && echo "Unknown version" && exit 1
|
||||||
|
[ -z "$ARCH" ] && echo "Unknown architecture" && exit 1
|
||||||
|
[ -z "$DIR" ] && echo "Unknown output dir" && exit 1
|
||||||
|
|
||||||
|
case $ARCH in
|
||||||
|
amd64|x86_64)
|
||||||
|
archname=amd64
|
||||||
|
;;
|
||||||
|
aarch64|arm64)
|
||||||
|
archname=aarch64
|
||||||
|
;;
|
||||||
|
armv7l|arm)
|
||||||
|
archname=armhf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unkown architecture"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $TAG in
|
||||||
|
master)
|
||||||
|
echo "Ignore TAG $TAG"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "build ANTOS deb package for version $TAG, architecture $ARCH"
|
||||||
|
|
||||||
|
NAME="AntOS_${TAG}_${archname}"
|
||||||
|
FILE="$NAME.deb"
|
||||||
|
TMP="/tmp/$NAME"
|
||||||
|
[ -d "$TMP" ] && rm -rf "$TMP"
|
||||||
|
mkdir -p $TMP
|
||||||
|
|
||||||
|
echo "Copying binaries of version $TAG, architecture $ARCH to $TMP"
|
||||||
|
cp $DIR/opt $TMP/ -rf
|
||||||
|
cd $TMP
|
||||||
|
mkdir DEBIAN
|
||||||
|
|
||||||
|
cat << EOF >> DEBIAN/control
|
||||||
|
Package: AntOS
|
||||||
|
Version: $TAG
|
||||||
|
Architecture: $archname
|
||||||
|
Depends: libsqlite3-0,zlib1g,libreadline8,libssl1.1,libvncclient1,libjpeg-turbo8 | libturbojpeg0
|
||||||
|
Maintainer: Dany LE <mrsang@iohub.dev>
|
||||||
|
Description: All-in-one AntOS remote web-based desktop environment
|
||||||
|
EOF
|
||||||
|
cat DEBIAN/control
|
||||||
|
cd ..
|
||||||
|
dpkg-deb --build $TMP
|
||||||
|
mv "$FILE" "$DIR/"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user