From 41eb0458e5bde4f06b0ab9d6aa0c9e2a137380f1 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Wed, 25 Sep 2024 20:14:40 +0200 Subject: Add AndroidDebugBridge to debian setup. --- doc/note/setup/setup-debian.txt | 2 +- doc/note/sqlite/execSqlFileThroughPhp.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/note/setup/setup-debian.txt b/doc/note/setup/setup-debian.txt index 582764e..1924e34 100644 --- a/doc/note/setup/setup-debian.txt +++ b/doc/note/setup/setup-debian.txt @@ -124,7 +124,7 @@ Populate "/etc/environment" as described by "./etc-environment". `# Low level ` \ lm-sensors fancontrol exfat-fuse exfatprogs \ `# Others` \ - systemd-sysv bc rsync qrencode libxml2-utils \ + systemd-sysv bc rsync qrencode libxml2-utils adb \ `# Nvidia graphics (open)` \ mesa-utils clinfo mesa-opencl-icd \ `# Nvidia graphics (non-free, DoesNotWorkYet)` \ diff --git a/doc/note/sqlite/execSqlFileThroughPhp.txt b/doc/note/sqlite/execSqlFileThroughPhp.txt index 3bb4126..da080b1 100644 --- a/doc/note/sqlite/execSqlFileThroughPhp.txt +++ b/doc/note/sqlite/execSqlFileThroughPhp.txt @@ -1,7 +1,7 @@ enableExceptions(true); -- cgit v1.1 From 3ab8016f38216d8cd763386f1c9827b25afb384b Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 28 Sep 2024 15:24:50 +0200 Subject: Move setup scripts away from qemu dir --- doc/note/qemu/build-cJSON.txt | 76 --------------------------- doc/note/qemu/build-gateleen.txt | 84 ----------------------------- doc/note/qemu/build-libarchive.txt | 72 ------------------------- doc/note/qemu/build-libcurl.txt | 99 ----------------------------------- doc/note/qemu/build-libpcap.txt | 64 ---------------------- doc/note/qemu/build-libpcre1.txt | 70 ------------------------- doc/note/qemu/build-lua.txt | 86 ------------------------------ doc/note/qemu/build-sqlite.txt | 77 --------------------------- doc/note/qemu/build-zlib.txt | 73 -------------------------- doc/note/qemu/compile-qemu-itself.txt | 27 ++++++++++ doc/note/qemu/docker-microVM.txt | 86 ++++++++++++++++++++++++++++++ doc/note/qemu/php-dev-server.txt | 48 ----------------- doc/note/qemu/qemu-compile-itself.txt | 27 ---------- doc/note/qemu/setup-android-env.txt | 85 ------------------------------ doc/note/qemu/setup-dockerVM.txt | 86 ------------------------------ doc/note/qemu/setup-jni-env.txt | 22 -------- doc/note/qemu/setup-jre8-env.txt | 18 ------- doc/note/qemu/setup-maven-env.txt | 16 ------ doc/note/qemu/setup-nginx-env.txt | 48 ----------------- doc/note/qemu/setup-windoof.txt | 40 -------------- doc/note/setup/build-cJSON.txt | 76 +++++++++++++++++++++++++++ doc/note/setup/build-gateleen.txt | 84 +++++++++++++++++++++++++++++ doc/note/setup/build-libarchive.txt | 72 +++++++++++++++++++++++++ doc/note/setup/build-libcurl.txt | 99 +++++++++++++++++++++++++++++++++++ doc/note/setup/build-libpcap.txt | 64 ++++++++++++++++++++++ doc/note/setup/build-libpcre1.txt | 70 +++++++++++++++++++++++++ doc/note/setup/build-lua.txt | 86 ++++++++++++++++++++++++++++++ doc/note/setup/build-sqlite.txt | 77 +++++++++++++++++++++++++++ doc/note/setup/build-zlib.txt | 73 ++++++++++++++++++++++++++ doc/note/setup/php-dev-server.txt | 48 +++++++++++++++++ doc/note/setup/setup-android-env.txt | 85 ++++++++++++++++++++++++++++++ doc/note/setup/setup-jni-env.txt | 22 ++++++++ doc/note/setup/setup-jre8-env.txt | 18 +++++++ doc/note/setup/setup-maven-env.txt | 16 ++++++ doc/note/setup/setup-nginx-env.txt | 48 +++++++++++++++++ doc/note/setup/setup-windoof.txt | 40 ++++++++++++++ 36 files changed, 1091 insertions(+), 1091 deletions(-) delete mode 100644 doc/note/qemu/build-cJSON.txt delete mode 100644 doc/note/qemu/build-gateleen.txt delete mode 100644 doc/note/qemu/build-libarchive.txt delete mode 100644 doc/note/qemu/build-libcurl.txt delete mode 100644 doc/note/qemu/build-libpcap.txt delete mode 100644 doc/note/qemu/build-libpcre1.txt delete mode 100644 doc/note/qemu/build-lua.txt delete mode 100644 doc/note/qemu/build-sqlite.txt delete mode 100644 doc/note/qemu/build-zlib.txt create mode 100644 doc/note/qemu/compile-qemu-itself.txt create mode 100644 doc/note/qemu/docker-microVM.txt delete mode 100644 doc/note/qemu/php-dev-server.txt delete mode 100644 doc/note/qemu/qemu-compile-itself.txt delete mode 100644 doc/note/qemu/setup-android-env.txt delete mode 100644 doc/note/qemu/setup-dockerVM.txt delete mode 100644 doc/note/qemu/setup-jni-env.txt delete mode 100644 doc/note/qemu/setup-jre8-env.txt delete mode 100644 doc/note/qemu/setup-maven-env.txt delete mode 100644 doc/note/qemu/setup-nginx-env.txt delete mode 100644 doc/note/qemu/setup-windoof.txt create mode 100644 doc/note/setup/build-cJSON.txt create mode 100644 doc/note/setup/build-gateleen.txt create mode 100644 doc/note/setup/build-libarchive.txt create mode 100644 doc/note/setup/build-libcurl.txt create mode 100644 doc/note/setup/build-libpcap.txt create mode 100644 doc/note/setup/build-libpcre1.txt create mode 100644 doc/note/setup/build-lua.txt create mode 100644 doc/note/setup/build-sqlite.txt create mode 100644 doc/note/setup/build-zlib.txt create mode 100644 doc/note/setup/php-dev-server.txt create mode 100644 doc/note/setup/setup-android-env.txt create mode 100644 doc/note/setup/setup-jni-env.txt create mode 100644 doc/note/setup/setup-jre8-env.txt create mode 100644 doc/note/setup/setup-maven-env.txt create mode 100644 doc/note/setup/setup-nginx-env.txt create mode 100644 doc/note/setup/setup-windoof.txt diff --git a/doc/note/qemu/build-cJSON.txt b/doc/note/qemu/build-cJSON.txt deleted file mode 100644 index 0e8d0df..0000000 --- a/doc/note/qemu/build-cJSON.txt +++ /dev/null @@ -1,76 +0,0 @@ - -### Debian native -true \ - && PKGS_TO_ADD="ca-certificates curl gcc libc6-dev" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="curl mingw-w64-gcc tar" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk clean" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -# Generic -true \ - && CJSON_VERSION="1.7.15" \ - && CACHE_DIR="/var/tmp" \ - && true - - -## Make -true \ - && CJSON_URL="https://github.com/DaveGamble/cJSON/archive/refs/tags/v${CJSON_VERSION:?}.tar.gz" \ - && CJSON_SRCTGZ="${CACHE_DIR:?}/cJSON-${CJSON_VERSION:?}.tgz" \ - && CJSON_BINTGZ="${CJSON_SRCTGZ%.*}-bin.tgz" \ - && ${PKGINIT:?} && ${PKGADD:?} ${PKGS_TO_ADD} \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && if test ! -e "${CJSON_SRCTGZ:?}"; then (true \ - && echo "Download \"${CJSON_URL:?}\"" \ - && curl -sSLo "${CJSON_SRCTGZ:?}" "${CJSON_URL:?}" \ - );fi \ - && if test ! -e "${CJSON_BINTGZ:?}"; then (true \ - && printf '\n Build cJSON\n\n' \ - && tar xzf "${CJSON_SRCTGZ:?}" \ - && cd "cJSON-${CJSON_VERSION:?}" \ - && mkdir build build/obj build/lib build/include \ - && CFLAGS="-Wall -pedantic -fPIC" \ - && ${HOST_}cc $CFLAGS -c -o build/obj/cJSON.o cJSON.c \ - && ${HOST_}cc $CFLAGS -shared -o build/lib/libcJSON.so.${CJSON_VERSION:?} build/obj/cJSON.o \ - && unset CFLAGS \ - && (cd build/lib \ - && MIN=${CJSON_VERSION%.*} && MAJ=${MIN%.*} \ - && ln -s libcJSON.so.${CJSON_VERSION:?} libcJSON.so.${MIN:?} \ - && ln -s libcJSON.so.${MIN:?} libcJSON.so.${MAJ} \ - ) \ - && ${HOST_}ar rcs build/lib/libcJSON.a build/obj/cJSON.o \ - && cp -t build/. LICENSE README.md \ - && cp -t build/include/. cJSON.h \ - && rm build/obj -rf \ - && (cd build \ - && find -type f -not -name MD5SUM -exec md5sum -b {} + > MD5SUM \ - && tar --owner=0 --group=0 -czf "${CJSON_BINTGZ:?}" * \ - && md5sum -b "${CJSON_BINTGZ:?}" > "${CJSON_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf "cJSON-${CJSON_VERSION:?}" \ - );fi \ - && printf '\n DONE\n\n' - - -## Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${CJSON_BINTGZ:?}" \ - && true - - - diff --git a/doc/note/qemu/build-gateleen.txt b/doc/note/qemu/build-gateleen.txt deleted file mode 100644 index 2763dae..0000000 --- a/doc/note/qemu/build-gateleen.txt +++ /dev/null @@ -1,84 +0,0 @@ - -Step-by-step shell snippets how to build gateleen -================================================= - - -## Alpine - - && PKGS_TO_ADD="curl maven nodejs npm redis openjdk11-jre-headless" \ - && SUDO="${HOME:?}/.local/bin/mysudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN=true \ - && mkdir -p "${HOME:?}/.local/bin" \ - && printf '%s\n' '#!/bin/sh' 'printf "Sudo "' 'su root -c "$(echo "$@")"' > "${HOME:?}/.local/bin/mysudo" \ - && chmod u+x "${HOME:?}/.local/bin/mysudo" \ - - -## Generic - - && GATELEEN_GIT_TAG="v1.3.28" \ - && WORKDIR="/${HOME:?}/work" \ - && CACHE_DIR="/var/tmp" \ - - -## Setup Dependencies & get sources - - && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ - \ - && curl -sSL https://github.com/swisspush/gateleen/archive/refs/tags/"${GATELEEN_GIT_TAG:?}".tar.gz > "${CACHE_DIR:?}/gateleen-${GATELEEN_GIT_TAG:?}.tgz" \ - - -## Corporation specific setup - -- Configure proxy if needed. -- Configure "/home/user/.npmrc" if needed. -- Configure "/home/user/.m2/settings.xml" if needed. - - -## Make - - && mkdir -p "${WORKDIR:?}/gateleen" && cd "${WORKDIR:?}/gateleen" \ - && tar --strip-components 1 -xf "${CACHE_DIR:?}/gateleen-${GATELEEN_GIT_TAG:?}.tgz" \ - && (cd gateleen-hook-js && npm install) \ - && mkdir -p gateleen-hook-js/node/node_modules/npm/bin \ - && ln -s /usr/bin/node gateleen-hook-js/node/node \ - && printf "require('/usr/lib/node_modules/npm/lib/cli.js')\n" | tee gateleen-hook-js/node/node_modules/npm/bin/npm-cli.js >/dev/null \ - && mvn install -PpublicRepos -DskipTests -Dskip.installnodenpm -pl gateleen-hook-js \ - && mvn install -PpublicRepos -DfailIfNoTests=false \ - -pl '!gateleen-test,!gateleen-hook-js' \ - '-Dtest=!ReleaseLockLuaScriptTests,!RedisCacheStorageTest,!DeltaHandlerTest,!QueueCircuitBreakerCloseCircuitLuaScriptTests,!QueueCircuitBreakerGetAllCircuitsLuaScriptTests,!QueueCircuitBreakerHalfOpenCircuitsLuaScriptTests,!QueueCircuitBreakerReOpenCircuitLuaScriptTests,!QueueCircuitBreakerUpdateStatsLuaScriptTests,!RemoveExpiredQueuesLuaScriptTests,!StartQueueTimerLuaScriptTests' \ - && mkdir "${WORKDIR:?}/classpath" \ - && (cd gateleen-playground && mvn dependency:copy-dependencies \ - -DexcludeScope=provided -DoutputDirectory="${WORKDIR:?}/classpath/.") \ - && cp gateleen-playground/target/gateleen-playground-*.jar "${WORKDIR:?}/classpath/." \ - && mkdir "${WORKDIR:?}/etc" "${WORKDIR:?}/redis-state" \ - && printf >"${WORKDIR:?}/etc/redis.conf" '%s\n' \ - 'save ""' \ - 'appendonly yes' \ - 'appendfilename appendonly.aof' \ - && `# Squeeze those funny "static files" into redis` \ - && (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf" \ - & java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \ - & sleep 3 \ - ) \ - && (cd "${WORKDIR:?}/gateleen" && mvn deploy -PuploadStaticFiles) \ - && (pkill -INT java || sleep 3 && pkill -TERM java || sleep 3 && pkill -9 java) \ - && pkill -INT redis-server \ - && $PKGDEL $PKGS_TO_DEL \ - && $PKGCLEAN \ - && sleep 3 \ - && (cd "${WORKDIR:?}/gateleen" && mvn clean) \ - && printf '\n DONE\n\n' \ - - -### Run - - && ip a | grep inet \ - && (true \ - && (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf") \ - & true \ - && cd ~ \ - && java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \ - ) \ - diff --git a/doc/note/qemu/build-libarchive.txt b/doc/note/qemu/build-libarchive.txt deleted file mode 100644 index 96f95d6..0000000 --- a/doc/note/qemu/build-libarchive.txt +++ /dev/null @@ -1,72 +0,0 @@ - -### Debian native -### TODO: test this -true \ - && PKGS_TO_ADD="make gcc curl ca-certificates libc6-dev" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="make mingw-w64-gcc curl tar" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk cache clean 2>&1| grep -v 'ERROR: Package cache is not enabled'" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -### General -true \ - && LIBARCHIVE_VERSION="3.6.2" \ - && CACHE_DIR="/var/tmp" \ - && true - - -### Make -true \ - && if test -n "$(ls -A)"; then true \ - && printf '\n It is recommended to run this script in an empty dir.\n\n' \ - && false \ - ;fi \ - && LIBARCHIVE_URL="https://github.com/libarchive/libarchive/releases/download/v${LIBARCHIVE_VERSION:?}/libarchive-${LIBARCHIVE_VERSION:?}.tar.gz" \ - && LIBARCHIVE_SRCTGZ="${CACHE_DIR:?}/libarchive-${LIBARCHIVE_VERSION:?}.tgz" \ - && LIBARCHIVE_BINTGZ="${LIBARCHIVE_SRCTGZ%.*}-bin.tgz" \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ - && if test ! -e "${LIBARCHIVE_SRCTGZ:?}"; then true \ - && echo "Download ${LIBARCHIVE_URL:?}" \ - && curl -sSLo "${LIBARCHIVE_SRCTGZ:?}" "${LIBARCHIVE_URL:?}" \ - ;fi \ - && if test ! -e "${LIBARCHIVE_BINTGZ}"; then (true \ - && printf '\n Build libarchive\n\n' \ - && tar xf "${LIBARCHIVE_SRCTGZ:?}" \ - && cd "libarchive-${LIBARCHIVE_VERSION:?}" \ - && ./configure --prefix="${PWD:?}/build/usr_local" --host=${HOST} \ - --enable-bsdtar=static --enable-bsdcat=static --enable-bsdcpio=static \ - --disable-rpath --enable-posix-regex-lib \ - --with-libiconv-prefix="${PWD%/*}/libiconv-1.16-mingw64" \ - CC=${HOST_}gcc CPP=${HOST_}cpp \ - && make clean && make -j$(nproc) && make install \ - && (cd build/usr_local \ - && rm -rf lib/pkgconfig lib/libarchive.la \ - && find -type f -not -wholename MD5SUM -exec md5sum {} + > MD5SUM \ - && tar --owner=0 --group=0 -czf "${LIBARCHIVE_BINTGZ:?}" * \ - && md5sum -b "${LIBARCHIVE_BINTGZ:?}" > "${LIBARCHIVE_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf "libarchive-${LIBARCHIVE_VERSION:?}" \ - );fi \ - && printf '\n DONE\n\n' - - -## Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${LIBARCHIVE_BINTGZ:?}" \ - && true - diff --git a/doc/note/qemu/build-libcurl.txt b/doc/note/qemu/build-libcurl.txt deleted file mode 100644 index be7b8c2..0000000 --- a/doc/note/qemu/build-libcurl.txt +++ /dev/null @@ -1,99 +0,0 @@ - - -### Debian native -true \ - && PKGS_TO_ADD="autoconf automake ca-certificates curl make" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="git make mingw-w64-gcc curl tar cmake autoconf automake libtool m4" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk clean" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -## Generic -true \ - && CURL_VERSION="8.3.0" \ - && CACHE_DIR="/var/tmp" \ - && true - - -## Make -true \ - && if test -n "$(ls -A)"; then true \ - && printf '\n It is recommended to run this script in an empty dir.\n\n' \ - && false \ - ;fi \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && CURL_VERSION_UGLY="$(echo "$CURL_VERSION"|sed 's;\.;_;g')" \ - && CURL_URL="https://github.com/curl/curl/archive/refs/tags/curl-${CURL_VERSION_UGLY:?}.tar.gz" \ - && CURL_SRCTGZ="${CACHE_DIR:?}/curl-${CURL_VERSION:?}.tgz" \ - && CURL_BINTGZ="${CURL_SRCTGZ%.*}-bin.tgz" \ - \ - && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ - && printf '\n Download Sources\n\n' \ - && if test ! -e "${CURL_SRCTGZ:?}"; then true \ - && echo "Download ${CURL_URL:?}" \ - && curl -sSLo "${CURL_SRCTGZ:?}" "${CURL_URL:?}" \ - ;fi \ - && if test ! -e "${CURL_BINTGZ:?}"; then (true \ - && printf '\n Build curl\n\n' \ - && tar xf "${CURL_SRCTGZ:?}" \ - && cd "curl-curl-${CURL_VERSION_UGLY:?}" \ - && autoreconf -fi \ - && if test -n "$HOST"; then HORSCHT="--host=${HOST:?}";fi \ - && ./configure --prefix="$PWD/build/usr_local" --enable-http --with-nghttp2 --with-nghttp3 \ - --disable-alt-svc --disable-ares --disable-aws --disable-basic-auth \ - --disable-bearer-auth --disable-bindlocal --disable-cookies --disable-curldebug \ - --disable-dateparse --disable-debug --disable-dependency-tracking --disable-dict \ - --disable-digest-auth --disable-dnsshuffle --disable-doh --disable-ech --disable-file \ - --disable-form-api --disable-ftp --disable-get-easy-options --disable-gopher \ - --disable-headers-api --disable-hsts --disable-http-auth --disable-imap --enable-ipv6 \ - --disable-kerberos-auth --disable-largefile --disable-ldap --disable-ldaps \ - --disable-libcurl-option --disable-libtool-lock --enable-manual --disable-mime \ - --disable-mqtt --disable-negotiate-auth --disable-netrc --enable-ntlm --enable-ntlm-wb \ - --disable-openssl-auto-load-config --disable-optimize --disable-pop3 \ - --disable-progress-meter --enable-proxy --disable-pthreads --disable-rt --disable-rtsp \ - --disable-smb --enable-smtp --disable-socketpair --disable-sspi --disable-symbol-hiding \ - --disable-telnet --disable-tftp --disable-threaded-resolver --disable-tls-srp \ - --disable-unix-sockets --disable-verbose --disable-versioned-symbols --disable-warnings \ - --disable-websockets --disable-werror --without-schannel --without-secure-transport \ - --without-amissl --without-ssl --without-openssl --without-gnutls --without-mbedtls \ - --without-wolfssl --without-bearssl --without-rustls --without-test-nghttpx \ - --without-test-caddy --without-test-httpd --without-pic --without-aix-soname \ - --without-gnu-ld --without-sysroot --without-mingw1-deprecated --without-hyper \ - --without-zlib --without-brotli --without-zstd --without-ldap-lib --without-lber-lib \ - --without-gssapi-includes --without-gssapi-libs --without-gssapi \ - --without-default-ssl-backend --without-random --without-ca-bundle --without-ca-path \ - --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp \ - --without-winidn --without-libidn2 --without-ngtcp2 --without-quiche --without-msh3 \ - --without-zsh-functions-dir --without-fish-functions-dir \ - CFLAGS=-fPIC $HORSCHT \ - && make clean && make -j$(nproc) && make install \ - && (cd build/usr_local \ - && rm -rf share/aclocal bin/curl-config lib/libcurl.la lib/pkgconfig \ - && tar --owner=0 --group=0 -czf "${CURL_BINTGZ:?}" * \ - && md5sum -b "${CURL_BINTGZ:?}" > "${CURL_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf "curl-curl-${CURL_VERSION_UGLY:?}" \ - );fi \ - && printf '\n DONE\n\n' - - -### Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${CURL_BINTGZ:?}" \ - && true - - diff --git a/doc/note/qemu/build-libpcap.txt b/doc/note/qemu/build-libpcap.txt deleted file mode 100644 index b86dd1c..0000000 --- a/doc/note/qemu/build-libpcap.txt +++ /dev/null @@ -1,64 +0,0 @@ - -### Debian native -true \ - && PKGS_TO_ADD="curl ca-certificates gcc make libc6-dev flex bison" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="binutils curl mingw-w64-gcc make tar flex bison" \ - && SUDO="/home/$USER/.local/bin/mysudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -## Generic -true \ - && PCAP_VERSION="1.10.4" \ - && CACHE_DIR="/var/tmp" \ - && WORKDIR="/tmp" \ - && INSTALL_ROOT="/usr/local" \ - && MAKE_JOBS=$(nproc) \ - && true - - -## Make -true \ - && PCAP_URL="https://github.com/the-tcpdump-group/libpcap/archive/refs/tags/libpcap-${PCAP_VERSION:?}.tar.gz" \ - && PCAP_SRCTGZ="${CACHE_DIR:?}/pcap-${PCAP_VERSION:?}.tgz" \ - && PCAP_BINTGZ="${PCAP_SRCTGZ%.*}-bin.tgz" \ - && if test -f "${PCAP_SRCTGZ:?}" ]; then true \ - && echo "[DEBUG] Already have \"${PCAP_SRCTGZ:?}\"" \ - ;else true \ - && echo curl -sSL "${PCAP_URL:?}" -o "${PCAP_SRCTGZ:?}" \ - && curl -sSL "${PCAP_URL:?}" -o "${PCAP_SRCTGZ:?}" \ - ;fi \ - && ( mkdir "${WORKDIR:?}/pcap-${PCAP_VERSION}" \ - && cd "${WORKDIR:?}/pcap-${PCAP_VERSION}" \ - && tar xf "${PCAP_SRCTGZ:?}" \ - && cd * \ - && ./configure --prefix=${WORKDIR:?}/pcap-"${PCAP_VERSION:?}"/out \ - && make clean \ - && make -j$(nproc) \ - && make install \ - && cd ../out \ - && rm bin/pcap-config lib/pkgconfig -rf \ - && tar cf "${PCAP_BINTGZ:?}" * \ - && printf '\n Build pcap Done\n\n' \ - ) \ - && true - - -### Install -true \ - && $SUDO mkdir -p "${INSTALL_ROOT:?}" \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xf "${PCAP_BINTGZ:?}" \ - && true - diff --git a/doc/note/qemu/build-libpcre1.txt b/doc/note/qemu/build-libpcre1.txt deleted file mode 100644 index 491809b..0000000 --- a/doc/note/qemu/build-libpcre1.txt +++ /dev/null @@ -1,70 +0,0 @@ - - -### Debian native -true \ - && PKGS_TO_ADD="curl git make gcc ca-certificates libc6-dev cmake autoconf automake libtool m4" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="git make mingw-w64-gcc curl tar cmake autoconf automake libtool m4" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk clean" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -## Generic -true \ - && PCRE_VERSION="8.45" \ - && CACHE_DIR="/var/tmp" \ - && true - - -## Make -true \ - && if test -n "$(ls -A)"; then true \ - && printf '\n It is recommended to run this script in an empty dir.\n\n' \ - && false \ - ;fi \ - && PCRE_URL="https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION:?}/pcre-${PCRE_VERSION:?}.tar.gz/download" \ - && PCRE_SRCTGZ="${CACHE_DIR:?}/pcre-${PCRE_VERSION:?}.tgz" \ - && PCRE_BINTGZ="${PCRE_SRCTGZ%.*}-bin.tgz" \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ - && printf '\n Download Dependency Sources\n\n' \ - && if test ! -e "${PCRE_SRCTGZ:?}"; then true \ - && echo "Download ${PCRE_URL:?}" \ - && curl -sSLo "${PCRE_SRCTGZ:?}" "${PCRE_URL:?}" \ - ;fi \ - && if test ! -e "${PCRE_BINTGZ:?}"; then (true \ - && printf '\n Build curl\n\n' \ - && tar xf "${PCRE_SRCTGZ:?}" \ - && cd "pcre-${PCRE_VERSION:?}" \ - && ./configure --prefix="$PWD/build/usr_local" --host=$HOST --disable-cpp --enable-utf \ - && make clean && make -j$(nproc) && make install \ - && (cd build/usr_local \ - && rm -rf lib/libpcre.la lib/pkgconfig lib/libpcreposix.la bin/pcre-config \ - && tar --owner=0 --group=0 -czf "${PCRE_BINTGZ:?}" * \ - && md5sum -b "${PCRE_BINTGZ:?}" > "${PCRE_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf "pcre-${PCRE_VERSION:?}" \ - );fi \ - && printf '\n DONE\n\n' - - -## Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${PCRE_BINTGZ:?}" \ - && true - - - diff --git a/doc/note/qemu/build-lua.txt b/doc/note/qemu/build-lua.txt deleted file mode 100644 index 5440233..0000000 --- a/doc/note/qemu/build-lua.txt +++ /dev/null @@ -1,86 +0,0 @@ - -### Debian native -true \ - && PKGS_TO_ADD="curl ca-certificates gcc make libc6-dev" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="binutils curl mingw-w64-gcc make tar" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk clean" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -## Generic -true \ - && LUA_VERSION="5.4.3" \ - && CACHE_DIR="/var/tmp" \ - && true - - -## Make -true \ - && if test -n "$(ls -A)"; then true \ - && printf '\n It is recommended to run this script in an empty dir.\n\n' \ - && false \ - ;fi \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ - && LUA_URL="https://www.lua.org/ftp/lua-${LUA_VERSION:?}.tar.gz" \ - && LUA_SRCTGZ="${CACHE_DIR:?}/lua-${LUA_VERSION:?}.tgz" \ - && LUA_BINTGZ="${LUA_SRCTGZ%.*}-bin.tgz" \ - && printf '\n Download Dependency Sources\n\n' \ - && if test ! -e "${LUA_SRCTGZ:?}"; then true \ - && echo "Download ${LUA_URL:?}" \ - && curl -sSLo "${LUA_SRCTGZ:?}" "${LUA_URL:?}" \ - ;fi \ - && if test ! -e "${LUA_BINTGZ:?}"; then (true \ - && printf '\n Build lua\n\n' \ - && tar xf "${LUA_SRCTGZ:?}" \ - && cd "lua-${LUA_VERSION:?}" \ - && mkdir -p build/bin build/include build/lib build/man/man1 \ - && export CFLAGS="-ggdb -Wall -Wextra" \ - && `# Uncomment this line for debugging` \ - && export CFLAGS="$CFLAGS -DLUAI_ASSERT -DLUA_USE_APICHECK" \ - && `# endOf Uncomment` \ - && make clean \ - && if echo "$HOST"|grep -q '\-mingw'; then true \ - && make -j$(nproc) PLAT=mingw \ - CC="${HOST_}gcc -std=gnu99" AR="${HOST_}ar rcu" RANLIB="${HOST_}ranlib" \ - && cp -t build/. README \ - && cp -t build/bin/. src/lua.exe src/luac.exe \ - ;else true \ - && export CFLAGS="$CFLAGS -DLUA_USE_POSIX" \ - && make -j$(nproc) \ - && cp -t build/. README \ - && cp -t build/bin/. src/lua src/luac \ - ;fi \ - && cp -t build/include/. src/lua.h src/luaconf.h src/lualib.h src/lauxlib.h src/lua.hpp \ - && cp -t build/lib/. src/liblua.a \ - && cp -t build/man/man1/. doc/lua.1 doc/luac.1 \ - && (cd build \ - && rm -rf include/lua.hpp \ - && tar --owner=0 --group=0 -czf "${LUA_BINTGZ:?}" * \ - && md5sum -b "${LUA_BINTGZ:?}" > "${LUA_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf "lua-${LUA_VERSION:?}" \ - );fi \ - && printf '\n DONE\n\n' - - -## Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${LUA_BINTGZ:?}" \ - && true - - diff --git a/doc/note/qemu/build-sqlite.txt b/doc/note/qemu/build-sqlite.txt deleted file mode 100644 index 81210f9..0000000 --- a/doc/note/qemu/build-sqlite.txt +++ /dev/null @@ -1,77 +0,0 @@ - -### Debian native -true \ - && PKGS_TO_ADD="curl ca-certificates gcc libc6-dev make tcl" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="curl gcc musl-dev make mingw-w64-gcc tar tcl" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk clean" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -## Generic -true \ - && SQLITE_VERSION="3.33.0" \ - && CACHE_DIR="/var/tmp" \ - && true - - -## Make -true \ - && SQLITE_URL="https://github.com/sqlite/sqlite/archive/refs/tags/version-${SQLITE_VERSION:?}.tar.gz" \ - && SQLITE_SRCTGZ="${CACHE_DIR:?}/sqlite-${SQLITE_VERSION:?}.tgz" \ - && SQLITE_BINTGZ="${SQLITE_SRCTGZ%.*}-bin.tgz" \ - && ${PKGINIT:?} && ${PKGADD:?} ${PKGS_TO_ADD} \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && if test ! -e "${SQLITE_SRCTGZ:?}"; then (true \ - && echo "Download \"${SQLITE_URL:?}\"" \ - && curl -sSLo "${SQLITE_SRCTGZ:?}" "${SQLITE_URL:?}" \ - );fi \ - && if test ! -e "${SQLITE_BINTGZ:?}"; then (true \ - && printf '\n Build SqLite\n\n' \ - && tar xzf "${SQLITE_SRCTGZ:?}" \ - && cd sqlite-*${SQLITE_VERSION:?} \ - && mkdir build \ - && if echo $HOST|grep -q 'mingw'; then true \ - && ./configure --prefix=${PWD:?}/build --host=${HOST:?} \ - CC=${HOST_}cc CPP=$CPP CXX=$CXX BCC=gcc BEXE=.exe config_TARGET_EXEEXT=.exe \ - && ln -s mksourceid.exe mksourceid \ - && make clean && make -j$(nproc) && make install \ - && (cd build \ - && rm -rf lemon* mksourceid lib/pkgconfig lib/*.la \ - ) \ - ;else true \ - && ./configure --prefix=${PWD:?}/build \ - && make clean && make -j$(nproc) && make install \ - ;fi \ - && cp README.md LICENSE.md VERSION build/. \ - && (cd build \ - && rm -rf lib/libsqlite3.la lib/pkgconfig \ - && find -not -name MD5SUM -type f -exec md5sum -b {} + > MD5SUM \ - && tar --owner=0 --group=0 -czf "${SQLITE_BINTGZ:?}" * \ - && md5sum -b "${SQLITE_BINTGZ:?}" > "${SQLITE_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf sqlite-*${SQLITE_VERSION:?} \ - );fi \ - && printf '\n DONE\n\n' - - -## Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${SQLITE_BINTGZ:?}" \ - && true - - - diff --git a/doc/note/qemu/build-zlib.txt b/doc/note/qemu/build-zlib.txt deleted file mode 100644 index a90e616..0000000 --- a/doc/note/qemu/build-zlib.txt +++ /dev/null @@ -1,73 +0,0 @@ - -### Debian native -true \ - && PKGS_TO_ADD="curl ca-certificates gcc libc6-dev make" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && HOST= \ - && true - - -### Alpine mingw cross -true \ - && PKGS_TO_ADD="curl make mingw-w64-gcc tar" \ - && SUDO="/home/$USER/.local/bin/sudo" \ - && PKGINIT=true \ - && PKGADD="$SUDO apk add" \ - && PKGCLEAN="$SUDO apk clean" \ - && HOST=x86_64-w64-mingw32 \ - && true - - -## Generic -true \ - && ZLIB_VERSION="1.2.11" \ - && CACHE_DIR="/var/tmp" \ - && true - - -## Make -true \ - && ZLIB_URL="https://downloads.sourceforge.net/project/libpng/zlib/${ZLIB_VERSION:?}/zlib-${ZLIB_VERSION:?}.tar.gz" \ - && ZLIB_SRCTGZ="${CACHE_DIR:?}/zlib-${ZLIB_VERSION:?}.tgz" \ - && ZLIB_BINTGZ="${ZLIB_SRCTGZ%.*}-bin.tgz" \ - && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ - && if test ! -e "${ZLIB_SRCTGZ:?}"; then (true \ - && echo "Download \"${ZLIB_URL:?}\"" \ - && curl -sSLo "${ZLIB_SRCTGZ:?}" "${ZLIB_URL:?}" \ - );fi \ - && if test ! -e "${ZLIB_BINTGZ:?}"; then (true \ - && printf '\n Build zlib\n\n' \ - && tar xzf "${ZLIB_SRCTGZ:?}" \ - && cd "zlib-${ZLIB_VERSION:?}" \ - && mkdir build \ - && if echo $HOST|grep -q '\-mingw'; then true \ - && export DESTDIR=./build BINARY_PATH=/bin INCLUDE_PATH=/include LIBRARY_PATH=/lib \ - && sed -i "s;^PREFIX =.\*\$;;" win32/Makefile.gcc \ - && make -j$(nproc) -fwin32/Makefile.gcc PREFIX=${HOST_:?} \ - && make -fwin32/Makefile.gcc install PREFIX=${HOST_:?} \ - && unset DESTDIR BINARY_PATH INCLUDE_PATH LIBRARY_PATH \ - ;else true \ - && ./configure --prefix=$PWD/build \ - && make -j$(nproc) && make install \ - ;fi \ - && cp README build/. \ - && (cd build \ - && rm -rf lib/pkgconfig \ - && tar --owner=0 --group=0 -czf "${ZLIB_BINTGZ:?}" * \ - && md5sum -b "${ZLIB_BINTGZ:?}" > "${ZLIB_BINTGZ:?}.md5" \ - ) \ - && cd .. && rm -rf "zlib-${ZLIB_VERSION:?}" \ - );fi \ - && printf '\n DONE\n\n' - - -## Install -true \ - && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${ZLIB_BINTGZ:?}" \ - && true - - - diff --git a/doc/note/qemu/compile-qemu-itself.txt b/doc/note/qemu/compile-qemu-itself.txt new file mode 100644 index 0000000..aed0522 --- /dev/null +++ b/doc/note/qemu/compile-qemu-itself.txt @@ -0,0 +1,27 @@ + +# +# Compile qemu bullshit-free for windoof. +# +# [src](https://wiki.qemu.org/Hosts/W32) +# +# +# WARN: This does NOT work +# + +true \ + && QEMU_URL="https://download.qemu.org/qemu-8.2.1.tar.xz" \ + && SUDO=sudo \ + && WORKDIR=/home/${USER:?}/work \ + && CACHEDIR=/var/tmp \ + && QEMU_TXZ=$(basename "${QEMU_URL:?}") \ + && $SUDO apt install -y --no-install-recommends curl \ + && curl -D- "${QEMU_URL:?}" -o "${CACHEDIR:?}/${QEMU_TXZ:?}" \ + && mkdir -p "${WORKDIR:?}" \ + && cd "${WORKDIR:?}" \ + && tar xf "${CACHEDIR:?}/${QEMU_TXZ:?}" \ + && cd qemu* \ + && ./configure \ + && make \ + && true + + diff --git a/doc/note/qemu/docker-microVM.txt b/doc/note/qemu/docker-microVM.txt new file mode 100644 index 0000000..9bbcff7 --- /dev/null +++ b/doc/note/qemu/docker-microVM.txt @@ -0,0 +1,86 @@ + +# +# Use qemu to host dockerimages. +# +# [Execute Docker Containers as QEMU MicroVMs](https://mergeboard.com/blog/2-qemu-microvm-docker/) +# + +true \ + && LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz \ + && SUDO=sudo \ + && CACHEDIR=/var/tmp \ + && WORKDIR=/home/$USER/work \ + && LINUX_TXZ=$(basename "${LINUX_URL:?}") \ + && $SUDO apt install -y --no-install-recommends curl make gcc bc flex bison libc-dev libelf-dev libssl-dev \ + && cd "${CACHEDIR:?}" \ + && curl -L "${LINUX_URL:?}" -O \ + && mkdir -p "${WORKDIR:?}" \ + && cd "${WORKDIR:?}" \ + && tar xf "${CACHEDIR:?}/${LINUX_TXZ:?}" \ + && cd linux* \ + && base64 -d < .config && +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 +xqZFdHAYI2VciPZ/TosyDcUdAAA= +EOF +true \ + && make olddefconfig \ + && make -j$(nproc) \ + && base64 -d < "${CACHEDIR:?}/gagainit.c" && +H4sIACTh02UAA41UTYvbMBC9+1cIlwY7JKtsYSlsNoVSAj1s0x62pzQsijxORCzJq4+wacl/35Ed +u85HS3ywnp5n5j2NJNP+3Bq+SNbOlfaeUglmBUvNTHbDtaTLQq/oh+ELSD+Ughu9lcNM8w0YmvZp +9E4oXvgMyAMYo/TN+lOHsi4T51QhlsecVwLpk7idpVJ75c5p69h/2IivmSF9rpV1JIOc+cI9g9oK +o5UE5eYLMiF/IoJP/OPz09cJ9dbQQnNW0KVQ952pbectqKnqFWA8qArNfj4+DqL9OIq2WmSk8v3M +18A3SfW9NlMbs9obDoMjzjFsuRucxeaiAFybA+l2JeZ4ZcVKQUYKrVa1TF6wle1mVg76GXMsSg/r +tM547kjoEBEq1+gz0CInSeCSgzzphY8pmUzI8Jb0eqTa0TCdzr5PZ09NufCURqB2En8xwJxAM+/t +L+wGqUul4zYwiMhNJkyrMvp4d5eSBzLq1qtqop42nZqYBdxpsyM5w05kcadueOBVuOS2Q+6j+h11 +LX4LbfqXxcpeCEiafWlsnva+020Sunu2hMZ+pXfB8ZHbfYQu0R+RTKgkAJTlg8O+I97OF03x7nGK +lVaAi4hpaTQP4DCOEDZqlxMy2NLS2YAR1ui6LPniwVfTFl2XaNcyYCfL/Do1bHgYcbg+geaW8pXR +vgxMi5rc+gaAW2vrFJOQxIe/GMZY8Rt0/pdJm3h4BV5gaLjpuIpKqoXVbb/0azk4bQ7CFIucnAMD +zhtFbse4/W9r76rneAUAAA== +EOF +true \ + && gcc -Wall -static -o "${CACHEDIR:?}/gagainit" "${CACHEDIR:?}/gagainit.c" \ + && echo "[ERROR] TODO Need more steps here" && false \ + && true + + diff --git a/doc/note/qemu/php-dev-server.txt b/doc/note/qemu/php-dev-server.txt deleted file mode 100644 index c1a8b01..0000000 --- a/doc/note/qemu/php-dev-server.txt +++ /dev/null @@ -1,48 +0,0 @@ - -# PHP Dev Server - -## Setup - -true \ - && SUDO= \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGDEL="$SUDO apt purge -y" \ - && ${PKGADD:?} apt-transport-https lsb-release ca-certificates curl \ - && curl -sSL https://packages.sury.org/php/apt.gpg | $SUDO tee /etc/apt/trusted.gpg.d/php.gpg >/dev/null \ - && echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | $SUDO tee /etc/apt/sources.list.d/php.list >/dev/null \ - && $SUDO apt update \ - && ${PKGADD:?} php7.3-cli php7.3-sqlite3 \ - && $SUDO apt clean \ - && true - - -## Run - -true `# Setup common vars (host/guest)` \ - && GUESTWD=/home/user/serv \ - && GUESTSUDO=sudo \ - && CPY_INN="tmp" \ - && CPY_OUT="tmp" \ - && SSH="ssh user@localhost -p10022 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" \ - && true - -true `# Setup mounts & persistence (host)` \ - && tar c ${CPY_INN:?} | ${SSH:?} -- sh -c 'true && mkdir -p '"${GUESTWD:?}"' && cd '"${GUESTWD:?}"' && tar x' \ - && $SSH -- sh -c "true && $GUESTSUDO mount -tcifs //10.0.2.2/beef-webapp /mnt/beef-webapp" \ - && $SSH -- sh -c "true && mkdir ${GUESTWD:?}/src && $GUESTSUDO mount --bind /mnt/beef-webapp/src \"${GUESTWD:?}/src\"" \ - && true - -true `# Run dev server (guest)` \ - && cd "${GUESTWD:?}" \ - && DEBUG=1 php -dassert.bail=1 -dzend.assertions=1 -dassert.exception=1 -S 0.0.0.0:8080 src/index.php \ - && true - -true `# Copy persistence from vm back to host (host)` \ - && $SSH -- sh -c "true && cd \"${GUESTWD:?}\" && tar c \"${CPY_OUT:?}\"" | tar x \ - && true - - -## Links - -- [Install old php](https://tecadmin.net/how-to-install-php-on-debian-12/) - diff --git a/doc/note/qemu/qemu-compile-itself.txt b/doc/note/qemu/qemu-compile-itself.txt deleted file mode 100644 index aed0522..0000000 --- a/doc/note/qemu/qemu-compile-itself.txt +++ /dev/null @@ -1,27 +0,0 @@ - -# -# Compile qemu bullshit-free for windoof. -# -# [src](https://wiki.qemu.org/Hosts/W32) -# -# -# WARN: This does NOT work -# - -true \ - && QEMU_URL="https://download.qemu.org/qemu-8.2.1.tar.xz" \ - && SUDO=sudo \ - && WORKDIR=/home/${USER:?}/work \ - && CACHEDIR=/var/tmp \ - && QEMU_TXZ=$(basename "${QEMU_URL:?}") \ - && $SUDO apt install -y --no-install-recommends curl \ - && curl -D- "${QEMU_URL:?}" -o "${CACHEDIR:?}/${QEMU_TXZ:?}" \ - && mkdir -p "${WORKDIR:?}" \ - && cd "${WORKDIR:?}" \ - && tar xf "${CACHEDIR:?}/${QEMU_TXZ:?}" \ - && cd qemu* \ - && ./configure \ - && make \ - && true - - diff --git a/doc/note/qemu/setup-android-env.txt b/doc/note/qemu/setup-android-env.txt deleted file mode 100644 index 0008c16..0000000 --- a/doc/note/qemu/setup-android-env.txt +++ /dev/null @@ -1,85 +0,0 @@ -# -# Tools for Android development. -# -# HINT: Since JDK-8 is no longer available, we have to add clutter to -# apksigner command. Eg: -# apksigner -J-add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ -# -J-add-opens=java.base/sun.security.x509=ALL-UNNAMED \ -# -J-add-opens=java.base/sun.security.pkcs=ALL-UNNAMED -# -# Refs: -# - [Clean Android HelloWorld Tutorial](https://www.hanshq.net/command-line-android.html) -# - [List of available versions](https://dl.google.com/android/repository/repository-11.xml) -# -set -e - -### Made for debian 10 (alias buster) -true \ - && PKGS_TO_ADD="curl unzip openjdk-17-jdk-headless aapt apksigner zipalign adb android-sdk-platform-tools-common" \ - && SUDO=sudo \ - && PKGINIT="$SUDO apt update" \ - && PKGADD="$SUDO apt install -y --no-install-recommends" \ - && PKGCLEAN="$SUDO apt clean" \ - && PLATFORM_VERSION="24" \ - && BUILD_TOOLS_VERSION="34.0.0" \ - && CMDLINETOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip" \ - && BUILD_TOOLS_URL="https://dl.google.com/android/repository/build-tools_r25-linux.zip" \ - && PLATFORM_URL="https://dl.google.com/android/repository/platform-${PLATFORM_VERSION:?}_r02.zip" \ - && NDK_URL="https://dl.google.com/android/repository/android-ndk-r26b-linux.zip" \ - && BUILD_TOOLS_ZIP="$(basename "${BUILD_TOOLS_URL:?}")" \ - && PLATFORM_ZIP="$(basename "${PLATFORM_URL:?}")" \ - && NDK_ZIP="$(basename "${NDK_URL:?}")" \ - \ - && $PKGINIT \ - && $PKGADD $PKGS_TO_ADD \ - && `# Cmdline tools` \ - && (cd /var/tmp && curl -sSLO "${CMDLINETOOLS_URL:?}") \ - && if test -x /tmp/cmdline-tools; then echo >&2 "[ERROR] /tmp/cmdline-tools already exists"; false; fi \ - && (cd /tmp && unzip /var/tmp/$(basename "${CMDLINETOOLS_URL:?}") >/dev/null) \ - && $SUDO mkdir /usr/lib/android-sdk/cmdline-tools \ - && $SUDO mkdir /usr/lib/android-sdk/cmdline-tools/latest \ - && (cd /tmp/cmdline-tools && tar --owner=0 --group=0 -c bin lib source.properties) | (cd /usr/lib/android-sdk/cmdline-tools/latest && $SUDO tar x) \ - && `# Build Tools` \ - && (cd /var/tmp && curl -sSL "${BUILD_TOOLS_URL:?}" -o "${BUILD_TOOLS_ZIP:?}") \ - && mkdir "/tmp/${BUILD_TOOLS_ZIP%.*}" \ - && (cd "/tmp/${BUILD_TOOLS_ZIP%.*}" && unzip "/var/tmp/${BUILD_TOOLS_ZIP:?}") \ - && (cd "/tmp/${BUILD_TOOLS_ZIP%.*}" && tar --owner=0 --group=0 -c *) \ - | (cd /usr/lib/android-sdk/build-tools && $SUDO tar x) \ - && $SUDO find /usr/lib/android-sdk/build-tools -type d -exec chmod 755 {} + \ - && `# Those for some reason are broken (wrong linker) so use the debian variant.` \ - && (cd /usr/lib/android-sdk/build-tools/android* && $SUDO rm aapt zipalign) \ - && `# Platform` \ - && (cd /var/tmp && curl -sSL "${PLATFORM_URL:?}" -o "${PLATFORM_ZIP:?}") \ - && if test -x /tmp/android*; then echo >&2 '[ERROR] /tmp/android* already exists'; false; fi \ - && (cd /tmp && unzip "/var/tmp/${PLATFORM_ZIP:?}" >/dev/null) \ - && $SUDO mkdir /usr/lib/android-sdk/platforms \ - && (cd /tmp && mv android-* "android-${PLATFORM_VERSION:?}") \ - && (cd /tmp && tar --owner=0 --group=0 -c "android-${PLATFORM_VERSION:?}") \ - | (cd /usr/lib/android-sdk/platforms && $SUDO tar x) \ - && $SUDO find /usr/lib/android-sdk/platforms/android-* -type d -exec chmod o+rx {} + \ - && $SUDO find /usr/lib/android-sdk/platforms/android-* -type f -exec chmod o+r {} + \ - && `# Environ` \ - && printf >>~/.profile '%s\n' \ - "PATH=/usr/lib/android-sdk/build-tools/debian:\$PATH" \ - "PATH=\"$(ls -d /usr/lib/android-sdk/build-tools/android-*):\$PATH\"" \ - "PATH=\"/usr/lib/android-sdk/platform-tools:\$PATH\"" \ - "PATH=\"$(ls -d /usr/lib/android-sdk/build-tools/android-*):\$PATH\"" \ - "CLASSPATH=$(ls -d /usr/lib/android-sdk/build-tools/android-*/lib/dx.jar)" \ - "LD_LIBRARY_PATH=$(ls -d /usr/lib/android-sdk/build-tools/android-*/lib64):\$LD_LIBRARY_PATH" \ - "export PATH" \ - "export CLASSPATH" \ - "export LD_LIBRARY_PATH" \ - && `# NDK` \ - && (cd /var/tmp && curl -sSL "${NDK_URL:?}" -o "${NDK_ZIP:?}") \ - && mkdir "/tmp/${NDK_ZIP%.*}" \ - && (cd "/tmp/${NDK_ZIP%.*}" && unzip "/var/tmp/${NDK_ZIP:?}") \ - && `# TODO may worth throw away some of that garbage before moving it into place` \ - && (cd "/tmp/${NDK_ZIP%.*}" && tar --owner=0 --group=0 -c android-ndk-*) \ - | (cd "/usr/lib" && $SUDO tar x) \ - && $SUDO ln -s /usr/lib/android-ndk-* "/usr/lib/android-ndk" \ - && `# Cleanup` \ - && $PKGCLEAN \ - && rm -rf /tmp/* 2>/dev/null || true \ - && printf '\n Done :)\n\n Logout and login to get your new environ from ~/.profile\n\n' \ - && true - diff --git a/doc/note/qemu/setup-dockerVM.txt b/doc/note/qemu/setup-dockerVM.txt deleted file mode 100644 index 9bbcff7..0000000 --- a/doc/note/qemu/setup-dockerVM.txt +++ /dev/null @@ -1,86 +0,0 @@ - -# -# Use qemu to host dockerimages. -# -# [Execute Docker Containers as QEMU MicroVMs](https://mergeboard.com/blog/2-qemu-microvm-docker/) -# - -true \ - && LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz \ - && SUDO=sudo \ - && CACHEDIR=/var/tmp \ - && WORKDIR=/home/$USER/work \ - && LINUX_TXZ=$(basename "${LINUX_URL:?}") \ - && $SUDO apt install -y --no-install-recommends curl make gcc bc flex bison libc-dev libelf-dev libssl-dev \ - && cd "${CACHEDIR:?}" \ - && curl -L "${LINUX_URL:?}" -O \ - && mkdir -p "${WORKDIR:?}" \ - && cd "${WORKDIR:?}" \ - && tar xf "${CACHEDIR:?}/${LINUX_TXZ:?}" \ - && cd linux* \ - && base64 -d < .config && -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 -xqZFdHAYI2VciPZ/TosyDcUdAAA= -EOF -true \ - && make olddefconfig \ - && make -j$(nproc) \ - && base64 -d < "${CACHEDIR:?}/gagainit.c" && -H4sIACTh02UAA41UTYvbMBC9+1cIlwY7JKtsYSlsNoVSAj1s0x62pzQsijxORCzJq4+wacl/35Ed -u85HS3ywnp5n5j2NJNP+3Bq+SNbOlfaeUglmBUvNTHbDtaTLQq/oh+ELSD+Ughu9lcNM8w0YmvZp -9E4oXvgMyAMYo/TN+lOHsi4T51QhlsecVwLpk7idpVJ75c5p69h/2IivmSF9rpV1JIOc+cI9g9oK -o5UE5eYLMiF/IoJP/OPz09cJ9dbQQnNW0KVQ952pbectqKnqFWA8qArNfj4+DqL9OIq2WmSk8v3M -18A3SfW9NlMbs9obDoMjzjFsuRucxeaiAFybA+l2JeZ4ZcVKQUYKrVa1TF6wle1mVg76GXMsSg/r -tM547kjoEBEq1+gz0CInSeCSgzzphY8pmUzI8Jb0eqTa0TCdzr5PZ09NufCURqB2En8xwJxAM+/t -L+wGqUul4zYwiMhNJkyrMvp4d5eSBzLq1qtqop42nZqYBdxpsyM5w05kcadueOBVuOS2Q+6j+h11 -LX4LbfqXxcpeCEiafWlsnva+020Sunu2hMZ+pXfB8ZHbfYQu0R+RTKgkAJTlg8O+I97OF03x7nGK -lVaAi4hpaTQP4DCOEDZqlxMy2NLS2YAR1ui6LPniwVfTFl2XaNcyYCfL/Do1bHgYcbg+geaW8pXR -vgxMi5rc+gaAW2vrFJOQxIe/GMZY8Rt0/pdJm3h4BV5gaLjpuIpKqoXVbb/0azk4bQ7CFIucnAMD -zhtFbse4/W9r76rneAUAAA== -EOF -true \ - && gcc -Wall -static -o "${CACHEDIR:?}/gagainit" "${CACHEDIR:?}/gagainit.c" \ - && echo "[ERROR] TODO Need more steps here" && false \ - && true - - diff --git a/doc/note/qemu/setup-jni-env.txt b/doc/note/qemu/setup-jni-env.txt deleted file mode 100644 index 62d204a..0000000 --- a/doc/note/qemu/setup-jni-env.txt +++ /dev/null @@ -1,22 +0,0 @@ - -# -# Debian with tools for java-native-interface development. -# -# HINT: Since migration from docker, I switched it to jdk-17 (because 11 -# seems no longer available). This change is not yet tested. -# -set -e - - -### For debian 12 -true \ - && SUDO= \ - && export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64" \ - && $SUDO apt update \ - && $SUDO apt install -y --no-install-recommends \ - g++ make openjdk-17-jdk-headless \ - && (printf '%s\n' "JAVA_HOME=${JAVA_HOME:?}" \ - ) | $SUDO tee "/etc/environment" >/dev/null \ - && $SUDO apt clean \ - && true - diff --git a/doc/note/qemu/setup-jre8-env.txt b/doc/note/qemu/setup-jre8-env.txt deleted file mode 100644 index f39cf98..0000000 --- a/doc/note/qemu/setup-jre8-env.txt +++ /dev/null @@ -1,18 +0,0 @@ - -# -# openjdk java 1.8 runtime environment. -# - -### For alpine 3.16.0 -true \ - && apk add openjdk8-jre \ - && true - -### For debian 9 -true \ - && SUDO= \ - && $SUDO apt update \ - && `# Use one of openjdk-8-jre-headless or openjdk-8-jre` \ - && $SUDO apt install -y --no-install-recommends openjdk-8-jre \ - && true - diff --git a/doc/note/qemu/setup-maven-env.txt b/doc/note/qemu/setup-maven-env.txt deleted file mode 100644 index e4ce16d..0000000 --- a/doc/note/qemu/setup-maven-env.txt +++ /dev/null @@ -1,16 +0,0 @@ -# -# Maven build env. -# -# Use this to share your hosts repository with the container: -# -# mount -t cifs //10.0.2.2/path/to/.m2/repository /var/tmp/.m2/repository -# -set -e - - -### Made for alpine 3.16.0 -true \ - && apk add maven \ - && sed -i "s,, /var/tmp/.m2/repository\n,g" /usr/share/java/maven-3/conf/settings.xml \ - && true - diff --git a/doc/note/qemu/setup-nginx-env.txt b/doc/note/qemu/setup-nginx-env.txt deleted file mode 100644 index 9a5aeb2..0000000 --- a/doc/note/qemu/setup-nginx-env.txt +++ /dev/null @@ -1,48 +0,0 @@ -# -# Bare nginx server serving HTTP/80 and HTTPS/443. -# -set -e - - -### Made for alpine 3.16.0 -true \ - && CN="example.com" \ - \ - && apk add nginx openssl \ - && mkdir /etc/ssl/private \ - && openssl genrsa -out /etc/ssl/private/nginx.key 2048 \ - && openssl req -new -key /etc/ssl/private/nginx.key \ - -out /etc/ssl/private/nginx.csr \ - -subj "/C=/ST=/L=/O=/OU=/CN=${CN:?}" \ - && openssl x509 -req -days 365 -in /etc/ssl/private/nginx.csr \ - -signkey /etc/ssl/private/nginx.key -out /etc/ssl/certs/nginx.crt \ - && chgrp nginx /etc/ssl/private/nginx.key \ - && chmod 0640 /etc/ssl/private/nginx.key \ - && printf '%s\n' \ - 'server {' \ - ' listen 80 default_server;' \ - ' listen [::]:80 default_server;' \ - ' listen 443 ssl default_server;' \ - ' listen [::]:443 default_server;' \ - ' ssl_certificate /etc/ssl/certs/nginx.crt;' \ - ' ssl_certificate_key /etc/ssl/private/nginx.key;' \ - ' location / {' \ - ' root /srv/www;' \ - ' index index.html index.htm;' \ - ' }' \ - '}' \ - > /etc/nginx/http.d/default.conf \ - && mkdir /srv/www \ - && printf '

Nginx says hi

\n' > /srv/www/index.html \ - && chown nginx:nginx /srv/www \ - && chown nginx:nginx /srv/www/index.html \ - && apk del openssl \ - && `# Configure nginx as a service` \ - && rc-update add nginx \ - && /etc/init.d/nginx start \ - && sleep 1 \ - && echo \ - && printf 'GET /index.html HTTP/1.0\r\n\r\n'|nc localhost 80 \ - && echo \ - && true - diff --git a/doc/note/qemu/setup-windoof.txt b/doc/note/qemu/setup-windoof.txt deleted file mode 100644 index 5df2cac..0000000 --- a/doc/note/qemu/setup-windoof.txt +++ /dev/null @@ -1,40 +0,0 @@ - -Setup Windoof in a experiment VM -================================ - -Install system STRICTLY WITHOUT internet connection. - -Stop annoying windoof auto updates. Make sure to use windoof newlines (CRLF) in -the reg file: - - -Windows Registry Editor Version 5.00 -[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] -"NoAutoUpdate"=dword:00000001 - -curl -sSD- http://10.0.2.9:80/stop-annoying-updates.reg -O - -After running "reg" file, we can reboot windoof with internet connection. - -Download/Install: -- "https://learn.microsoft.com/en-us/sysinternals/downloads/sdelete" -- "https://notepad-plus-plus.org/" - -Install needed software (Maybe: firefox, MsOffice, MsTeams, ..?). - -Manually trigger updates, reboot, updates, reboot, (likely some more turns ...) - -Configure Performance options. Disable all but screen fonts. - -Make sure no more updates are running. Then, I guess best is to reboot without -internet access once more to cleanup the disk. Delete unused files like -trashcan or downloaded installers: - - SDelete.exe -nobanner -z C: - -Shutdown win guest, then compact disc. - - qemu-img convert -O qcow2 input.qcow output.qcow2 - -Image is ready. - diff --git a/doc/note/setup/build-cJSON.txt b/doc/note/setup/build-cJSON.txt new file mode 100644 index 0000000..0e8d0df --- /dev/null +++ b/doc/note/setup/build-cJSON.txt @@ -0,0 +1,76 @@ + +### Debian native +true \ + && PKGS_TO_ADD="ca-certificates curl gcc libc6-dev" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="curl mingw-w64-gcc tar" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk clean" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +# Generic +true \ + && CJSON_VERSION="1.7.15" \ + && CACHE_DIR="/var/tmp" \ + && true + + +## Make +true \ + && CJSON_URL="https://github.com/DaveGamble/cJSON/archive/refs/tags/v${CJSON_VERSION:?}.tar.gz" \ + && CJSON_SRCTGZ="${CACHE_DIR:?}/cJSON-${CJSON_VERSION:?}.tgz" \ + && CJSON_BINTGZ="${CJSON_SRCTGZ%.*}-bin.tgz" \ + && ${PKGINIT:?} && ${PKGADD:?} ${PKGS_TO_ADD} \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && if test ! -e "${CJSON_SRCTGZ:?}"; then (true \ + && echo "Download \"${CJSON_URL:?}\"" \ + && curl -sSLo "${CJSON_SRCTGZ:?}" "${CJSON_URL:?}" \ + );fi \ + && if test ! -e "${CJSON_BINTGZ:?}"; then (true \ + && printf '\n Build cJSON\n\n' \ + && tar xzf "${CJSON_SRCTGZ:?}" \ + && cd "cJSON-${CJSON_VERSION:?}" \ + && mkdir build build/obj build/lib build/include \ + && CFLAGS="-Wall -pedantic -fPIC" \ + && ${HOST_}cc $CFLAGS -c -o build/obj/cJSON.o cJSON.c \ + && ${HOST_}cc $CFLAGS -shared -o build/lib/libcJSON.so.${CJSON_VERSION:?} build/obj/cJSON.o \ + && unset CFLAGS \ + && (cd build/lib \ + && MIN=${CJSON_VERSION%.*} && MAJ=${MIN%.*} \ + && ln -s libcJSON.so.${CJSON_VERSION:?} libcJSON.so.${MIN:?} \ + && ln -s libcJSON.so.${MIN:?} libcJSON.so.${MAJ} \ + ) \ + && ${HOST_}ar rcs build/lib/libcJSON.a build/obj/cJSON.o \ + && cp -t build/. LICENSE README.md \ + && cp -t build/include/. cJSON.h \ + && rm build/obj -rf \ + && (cd build \ + && find -type f -not -name MD5SUM -exec md5sum -b {} + > MD5SUM \ + && tar --owner=0 --group=0 -czf "${CJSON_BINTGZ:?}" * \ + && md5sum -b "${CJSON_BINTGZ:?}" > "${CJSON_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf "cJSON-${CJSON_VERSION:?}" \ + );fi \ + && printf '\n DONE\n\n' + + +## Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${CJSON_BINTGZ:?}" \ + && true + + + diff --git a/doc/note/setup/build-gateleen.txt b/doc/note/setup/build-gateleen.txt new file mode 100644 index 0000000..2763dae --- /dev/null +++ b/doc/note/setup/build-gateleen.txt @@ -0,0 +1,84 @@ + +Step-by-step shell snippets how to build gateleen +================================================= + + +## Alpine + + && PKGS_TO_ADD="curl maven nodejs npm redis openjdk11-jre-headless" \ + && SUDO="${HOME:?}/.local/bin/mysudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN=true \ + && mkdir -p "${HOME:?}/.local/bin" \ + && printf '%s\n' '#!/bin/sh' 'printf "Sudo "' 'su root -c "$(echo "$@")"' > "${HOME:?}/.local/bin/mysudo" \ + && chmod u+x "${HOME:?}/.local/bin/mysudo" \ + + +## Generic + + && GATELEEN_GIT_TAG="v1.3.28" \ + && WORKDIR="/${HOME:?}/work" \ + && CACHE_DIR="/var/tmp" \ + + +## Setup Dependencies & get sources + + && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ + \ + && curl -sSL https://github.com/swisspush/gateleen/archive/refs/tags/"${GATELEEN_GIT_TAG:?}".tar.gz > "${CACHE_DIR:?}/gateleen-${GATELEEN_GIT_TAG:?}.tgz" \ + + +## Corporation specific setup + +- Configure proxy if needed. +- Configure "/home/user/.npmrc" if needed. +- Configure "/home/user/.m2/settings.xml" if needed. + + +## Make + + && mkdir -p "${WORKDIR:?}/gateleen" && cd "${WORKDIR:?}/gateleen" \ + && tar --strip-components 1 -xf "${CACHE_DIR:?}/gateleen-${GATELEEN_GIT_TAG:?}.tgz" \ + && (cd gateleen-hook-js && npm install) \ + && mkdir -p gateleen-hook-js/node/node_modules/npm/bin \ + && ln -s /usr/bin/node gateleen-hook-js/node/node \ + && printf "require('/usr/lib/node_modules/npm/lib/cli.js')\n" | tee gateleen-hook-js/node/node_modules/npm/bin/npm-cli.js >/dev/null \ + && mvn install -PpublicRepos -DskipTests -Dskip.installnodenpm -pl gateleen-hook-js \ + && mvn install -PpublicRepos -DfailIfNoTests=false \ + -pl '!gateleen-test,!gateleen-hook-js' \ + '-Dtest=!ReleaseLockLuaScriptTests,!RedisCacheStorageTest,!DeltaHandlerTest,!QueueCircuitBreakerCloseCircuitLuaScriptTests,!QueueCircuitBreakerGetAllCircuitsLuaScriptTests,!QueueCircuitBreakerHalfOpenCircuitsLuaScriptTests,!QueueCircuitBreakerReOpenCircuitLuaScriptTests,!QueueCircuitBreakerUpdateStatsLuaScriptTests,!RemoveExpiredQueuesLuaScriptTests,!StartQueueTimerLuaScriptTests' \ + && mkdir "${WORKDIR:?}/classpath" \ + && (cd gateleen-playground && mvn dependency:copy-dependencies \ + -DexcludeScope=provided -DoutputDirectory="${WORKDIR:?}/classpath/.") \ + && cp gateleen-playground/target/gateleen-playground-*.jar "${WORKDIR:?}/classpath/." \ + && mkdir "${WORKDIR:?}/etc" "${WORKDIR:?}/redis-state" \ + && printf >"${WORKDIR:?}/etc/redis.conf" '%s\n' \ + 'save ""' \ + 'appendonly yes' \ + 'appendfilename appendonly.aof' \ + && `# Squeeze those funny "static files" into redis` \ + && (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf" \ + & java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \ + & sleep 3 \ + ) \ + && (cd "${WORKDIR:?}/gateleen" && mvn deploy -PuploadStaticFiles) \ + && (pkill -INT java || sleep 3 && pkill -TERM java || sleep 3 && pkill -9 java) \ + && pkill -INT redis-server \ + && $PKGDEL $PKGS_TO_DEL \ + && $PKGCLEAN \ + && sleep 3 \ + && (cd "${WORKDIR:?}/gateleen" && mvn clean) \ + && printf '\n DONE\n\n' \ + + +### Run + + && ip a | grep inet \ + && (true \ + && (cd "${WORKDIR:?}/redis-state" && redis-server "${WORKDIR:?}/etc/redis.conf") \ + & true \ + && cd ~ \ + && java -cp "${WORKDIR:?}/classpath/"'*' org.swisspush.gateleen.playground.Server \ + ) \ + diff --git a/doc/note/setup/build-libarchive.txt b/doc/note/setup/build-libarchive.txt new file mode 100644 index 0000000..96f95d6 --- /dev/null +++ b/doc/note/setup/build-libarchive.txt @@ -0,0 +1,72 @@ + +### Debian native +### TODO: test this +true \ + && PKGS_TO_ADD="make gcc curl ca-certificates libc6-dev" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="make mingw-w64-gcc curl tar" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk cache clean 2>&1| grep -v 'ERROR: Package cache is not enabled'" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +### General +true \ + && LIBARCHIVE_VERSION="3.6.2" \ + && CACHE_DIR="/var/tmp" \ + && true + + +### Make +true \ + && if test -n "$(ls -A)"; then true \ + && printf '\n It is recommended to run this script in an empty dir.\n\n' \ + && false \ + ;fi \ + && LIBARCHIVE_URL="https://github.com/libarchive/libarchive/releases/download/v${LIBARCHIVE_VERSION:?}/libarchive-${LIBARCHIVE_VERSION:?}.tar.gz" \ + && LIBARCHIVE_SRCTGZ="${CACHE_DIR:?}/libarchive-${LIBARCHIVE_VERSION:?}.tgz" \ + && LIBARCHIVE_BINTGZ="${LIBARCHIVE_SRCTGZ%.*}-bin.tgz" \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ + && if test ! -e "${LIBARCHIVE_SRCTGZ:?}"; then true \ + && echo "Download ${LIBARCHIVE_URL:?}" \ + && curl -sSLo "${LIBARCHIVE_SRCTGZ:?}" "${LIBARCHIVE_URL:?}" \ + ;fi \ + && if test ! -e "${LIBARCHIVE_BINTGZ}"; then (true \ + && printf '\n Build libarchive\n\n' \ + && tar xf "${LIBARCHIVE_SRCTGZ:?}" \ + && cd "libarchive-${LIBARCHIVE_VERSION:?}" \ + && ./configure --prefix="${PWD:?}/build/usr_local" --host=${HOST} \ + --enable-bsdtar=static --enable-bsdcat=static --enable-bsdcpio=static \ + --disable-rpath --enable-posix-regex-lib \ + --with-libiconv-prefix="${PWD%/*}/libiconv-1.16-mingw64" \ + CC=${HOST_}gcc CPP=${HOST_}cpp \ + && make clean && make -j$(nproc) && make install \ + && (cd build/usr_local \ + && rm -rf lib/pkgconfig lib/libarchive.la \ + && find -type f -not -wholename MD5SUM -exec md5sum {} + > MD5SUM \ + && tar --owner=0 --group=0 -czf "${LIBARCHIVE_BINTGZ:?}" * \ + && md5sum -b "${LIBARCHIVE_BINTGZ:?}" > "${LIBARCHIVE_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf "libarchive-${LIBARCHIVE_VERSION:?}" \ + );fi \ + && printf '\n DONE\n\n' + + +## Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${LIBARCHIVE_BINTGZ:?}" \ + && true + diff --git a/doc/note/setup/build-libcurl.txt b/doc/note/setup/build-libcurl.txt new file mode 100644 index 0000000..be7b8c2 --- /dev/null +++ b/doc/note/setup/build-libcurl.txt @@ -0,0 +1,99 @@ + + +### Debian native +true \ + && PKGS_TO_ADD="autoconf automake ca-certificates curl make" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="git make mingw-w64-gcc curl tar cmake autoconf automake libtool m4" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk clean" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +## Generic +true \ + && CURL_VERSION="8.3.0" \ + && CACHE_DIR="/var/tmp" \ + && true + + +## Make +true \ + && if test -n "$(ls -A)"; then true \ + && printf '\n It is recommended to run this script in an empty dir.\n\n' \ + && false \ + ;fi \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && CURL_VERSION_UGLY="$(echo "$CURL_VERSION"|sed 's;\.;_;g')" \ + && CURL_URL="https://github.com/curl/curl/archive/refs/tags/curl-${CURL_VERSION_UGLY:?}.tar.gz" \ + && CURL_SRCTGZ="${CACHE_DIR:?}/curl-${CURL_VERSION:?}.tgz" \ + && CURL_BINTGZ="${CURL_SRCTGZ%.*}-bin.tgz" \ + \ + && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ + && printf '\n Download Sources\n\n' \ + && if test ! -e "${CURL_SRCTGZ:?}"; then true \ + && echo "Download ${CURL_URL:?}" \ + && curl -sSLo "${CURL_SRCTGZ:?}" "${CURL_URL:?}" \ + ;fi \ + && if test ! -e "${CURL_BINTGZ:?}"; then (true \ + && printf '\n Build curl\n\n' \ + && tar xf "${CURL_SRCTGZ:?}" \ + && cd "curl-curl-${CURL_VERSION_UGLY:?}" \ + && autoreconf -fi \ + && if test -n "$HOST"; then HORSCHT="--host=${HOST:?}";fi \ + && ./configure --prefix="$PWD/build/usr_local" --enable-http --with-nghttp2 --with-nghttp3 \ + --disable-alt-svc --disable-ares --disable-aws --disable-basic-auth \ + --disable-bearer-auth --disable-bindlocal --disable-cookies --disable-curldebug \ + --disable-dateparse --disable-debug --disable-dependency-tracking --disable-dict \ + --disable-digest-auth --disable-dnsshuffle --disable-doh --disable-ech --disable-file \ + --disable-form-api --disable-ftp --disable-get-easy-options --disable-gopher \ + --disable-headers-api --disable-hsts --disable-http-auth --disable-imap --enable-ipv6 \ + --disable-kerberos-auth --disable-largefile --disable-ldap --disable-ldaps \ + --disable-libcurl-option --disable-libtool-lock --enable-manual --disable-mime \ + --disable-mqtt --disable-negotiate-auth --disable-netrc --enable-ntlm --enable-ntlm-wb \ + --disable-openssl-auto-load-config --disable-optimize --disable-pop3 \ + --disable-progress-meter --enable-proxy --disable-pthreads --disable-rt --disable-rtsp \ + --disable-smb --enable-smtp --disable-socketpair --disable-sspi --disable-symbol-hiding \ + --disable-telnet --disable-tftp --disable-threaded-resolver --disable-tls-srp \ + --disable-unix-sockets --disable-verbose --disable-versioned-symbols --disable-warnings \ + --disable-websockets --disable-werror --without-schannel --without-secure-transport \ + --without-amissl --without-ssl --without-openssl --without-gnutls --without-mbedtls \ + --without-wolfssl --without-bearssl --without-rustls --without-test-nghttpx \ + --without-test-caddy --without-test-httpd --without-pic --without-aix-soname \ + --without-gnu-ld --without-sysroot --without-mingw1-deprecated --without-hyper \ + --without-zlib --without-brotli --without-zstd --without-ldap-lib --without-lber-lib \ + --without-gssapi-includes --without-gssapi-libs --without-gssapi \ + --without-default-ssl-backend --without-random --without-ca-bundle --without-ca-path \ + --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp \ + --without-winidn --without-libidn2 --without-ngtcp2 --without-quiche --without-msh3 \ + --without-zsh-functions-dir --without-fish-functions-dir \ + CFLAGS=-fPIC $HORSCHT \ + && make clean && make -j$(nproc) && make install \ + && (cd build/usr_local \ + && rm -rf share/aclocal bin/curl-config lib/libcurl.la lib/pkgconfig \ + && tar --owner=0 --group=0 -czf "${CURL_BINTGZ:?}" * \ + && md5sum -b "${CURL_BINTGZ:?}" > "${CURL_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf "curl-curl-${CURL_VERSION_UGLY:?}" \ + );fi \ + && printf '\n DONE\n\n' + + +### Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${CURL_BINTGZ:?}" \ + && true + + diff --git a/doc/note/setup/build-libpcap.txt b/doc/note/setup/build-libpcap.txt new file mode 100644 index 0000000..b86dd1c --- /dev/null +++ b/doc/note/setup/build-libpcap.txt @@ -0,0 +1,64 @@ + +### Debian native +true \ + && PKGS_TO_ADD="curl ca-certificates gcc make libc6-dev flex bison" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="binutils curl mingw-w64-gcc make tar flex bison" \ + && SUDO="/home/$USER/.local/bin/mysudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +## Generic +true \ + && PCAP_VERSION="1.10.4" \ + && CACHE_DIR="/var/tmp" \ + && WORKDIR="/tmp" \ + && INSTALL_ROOT="/usr/local" \ + && MAKE_JOBS=$(nproc) \ + && true + + +## Make +true \ + && PCAP_URL="https://github.com/the-tcpdump-group/libpcap/archive/refs/tags/libpcap-${PCAP_VERSION:?}.tar.gz" \ + && PCAP_SRCTGZ="${CACHE_DIR:?}/pcap-${PCAP_VERSION:?}.tgz" \ + && PCAP_BINTGZ="${PCAP_SRCTGZ%.*}-bin.tgz" \ + && if test -f "${PCAP_SRCTGZ:?}" ]; then true \ + && echo "[DEBUG] Already have \"${PCAP_SRCTGZ:?}\"" \ + ;else true \ + && echo curl -sSL "${PCAP_URL:?}" -o "${PCAP_SRCTGZ:?}" \ + && curl -sSL "${PCAP_URL:?}" -o "${PCAP_SRCTGZ:?}" \ + ;fi \ + && ( mkdir "${WORKDIR:?}/pcap-${PCAP_VERSION}" \ + && cd "${WORKDIR:?}/pcap-${PCAP_VERSION}" \ + && tar xf "${PCAP_SRCTGZ:?}" \ + && cd * \ + && ./configure --prefix=${WORKDIR:?}/pcap-"${PCAP_VERSION:?}"/out \ + && make clean \ + && make -j$(nproc) \ + && make install \ + && cd ../out \ + && rm bin/pcap-config lib/pkgconfig -rf \ + && tar cf "${PCAP_BINTGZ:?}" * \ + && printf '\n Build pcap Done\n\n' \ + ) \ + && true + + +### Install +true \ + && $SUDO mkdir -p "${INSTALL_ROOT:?}" \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xf "${PCAP_BINTGZ:?}" \ + && true + diff --git a/doc/note/setup/build-libpcre1.txt b/doc/note/setup/build-libpcre1.txt new file mode 100644 index 0000000..491809b --- /dev/null +++ b/doc/note/setup/build-libpcre1.txt @@ -0,0 +1,70 @@ + + +### Debian native +true \ + && PKGS_TO_ADD="curl git make gcc ca-certificates libc6-dev cmake autoconf automake libtool m4" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="git make mingw-w64-gcc curl tar cmake autoconf automake libtool m4" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk clean" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +## Generic +true \ + && PCRE_VERSION="8.45" \ + && CACHE_DIR="/var/tmp" \ + && true + + +## Make +true \ + && if test -n "$(ls -A)"; then true \ + && printf '\n It is recommended to run this script in an empty dir.\n\n' \ + && false \ + ;fi \ + && PCRE_URL="https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION:?}/pcre-${PCRE_VERSION:?}.tar.gz/download" \ + && PCRE_SRCTGZ="${CACHE_DIR:?}/pcre-${PCRE_VERSION:?}.tgz" \ + && PCRE_BINTGZ="${PCRE_SRCTGZ%.*}-bin.tgz" \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ + && printf '\n Download Dependency Sources\n\n' \ + && if test ! -e "${PCRE_SRCTGZ:?}"; then true \ + && echo "Download ${PCRE_URL:?}" \ + && curl -sSLo "${PCRE_SRCTGZ:?}" "${PCRE_URL:?}" \ + ;fi \ + && if test ! -e "${PCRE_BINTGZ:?}"; then (true \ + && printf '\n Build curl\n\n' \ + && tar xf "${PCRE_SRCTGZ:?}" \ + && cd "pcre-${PCRE_VERSION:?}" \ + && ./configure --prefix="$PWD/build/usr_local" --host=$HOST --disable-cpp --enable-utf \ + && make clean && make -j$(nproc) && make install \ + && (cd build/usr_local \ + && rm -rf lib/libpcre.la lib/pkgconfig lib/libpcreposix.la bin/pcre-config \ + && tar --owner=0 --group=0 -czf "${PCRE_BINTGZ:?}" * \ + && md5sum -b "${PCRE_BINTGZ:?}" > "${PCRE_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf "pcre-${PCRE_VERSION:?}" \ + );fi \ + && printf '\n DONE\n\n' + + +## Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${PCRE_BINTGZ:?}" \ + && true + + + diff --git a/doc/note/setup/build-lua.txt b/doc/note/setup/build-lua.txt new file mode 100644 index 0000000..5440233 --- /dev/null +++ b/doc/note/setup/build-lua.txt @@ -0,0 +1,86 @@ + +### Debian native +true \ + && PKGS_TO_ADD="curl ca-certificates gcc make libc6-dev" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="binutils curl mingw-w64-gcc make tar" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk clean" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +## Generic +true \ + && LUA_VERSION="5.4.3" \ + && CACHE_DIR="/var/tmp" \ + && true + + +## Make +true \ + && if test -n "$(ls -A)"; then true \ + && printf '\n It is recommended to run this script in an empty dir.\n\n' \ + && false \ + ;fi \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \ + && LUA_URL="https://www.lua.org/ftp/lua-${LUA_VERSION:?}.tar.gz" \ + && LUA_SRCTGZ="${CACHE_DIR:?}/lua-${LUA_VERSION:?}.tgz" \ + && LUA_BINTGZ="${LUA_SRCTGZ%.*}-bin.tgz" \ + && printf '\n Download Dependency Sources\n\n' \ + && if test ! -e "${LUA_SRCTGZ:?}"; then true \ + && echo "Download ${LUA_URL:?}" \ + && curl -sSLo "${LUA_SRCTGZ:?}" "${LUA_URL:?}" \ + ;fi \ + && if test ! -e "${LUA_BINTGZ:?}"; then (true \ + && printf '\n Build lua\n\n' \ + && tar xf "${LUA_SRCTGZ:?}" \ + && cd "lua-${LUA_VERSION:?}" \ + && mkdir -p build/bin build/include build/lib build/man/man1 \ + && export CFLAGS="-ggdb -Wall -Wextra" \ + && `# Uncomment this line for debugging` \ + && export CFLAGS="$CFLAGS -DLUAI_ASSERT -DLUA_USE_APICHECK" \ + && `# endOf Uncomment` \ + && make clean \ + && if echo "$HOST"|grep -q '\-mingw'; then true \ + && make -j$(nproc) PLAT=mingw \ + CC="${HOST_}gcc -std=gnu99" AR="${HOST_}ar rcu" RANLIB="${HOST_}ranlib" \ + && cp -t build/. README \ + && cp -t build/bin/. src/lua.exe src/luac.exe \ + ;else true \ + && export CFLAGS="$CFLAGS -DLUA_USE_POSIX" \ + && make -j$(nproc) \ + && cp -t build/. README \ + && cp -t build/bin/. src/lua src/luac \ + ;fi \ + && cp -t build/include/. src/lua.h src/luaconf.h src/lualib.h src/lauxlib.h src/lua.hpp \ + && cp -t build/lib/. src/liblua.a \ + && cp -t build/man/man1/. doc/lua.1 doc/luac.1 \ + && (cd build \ + && rm -rf include/lua.hpp \ + && tar --owner=0 --group=0 -czf "${LUA_BINTGZ:?}" * \ + && md5sum -b "${LUA_BINTGZ:?}" > "${LUA_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf "lua-${LUA_VERSION:?}" \ + );fi \ + && printf '\n DONE\n\n' + + +## Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${LUA_BINTGZ:?}" \ + && true + + diff --git a/doc/note/setup/build-sqlite.txt b/doc/note/setup/build-sqlite.txt new file mode 100644 index 0000000..81210f9 --- /dev/null +++ b/doc/note/setup/build-sqlite.txt @@ -0,0 +1,77 @@ + +### Debian native +true \ + && PKGS_TO_ADD="curl ca-certificates gcc libc6-dev make tcl" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="curl gcc musl-dev make mingw-w64-gcc tar tcl" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk clean" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +## Generic +true \ + && SQLITE_VERSION="3.33.0" \ + && CACHE_DIR="/var/tmp" \ + && true + + +## Make +true \ + && SQLITE_URL="https://github.com/sqlite/sqlite/archive/refs/tags/version-${SQLITE_VERSION:?}.tar.gz" \ + && SQLITE_SRCTGZ="${CACHE_DIR:?}/sqlite-${SQLITE_VERSION:?}.tgz" \ + && SQLITE_BINTGZ="${SQLITE_SRCTGZ%.*}-bin.tgz" \ + && ${PKGINIT:?} && ${PKGADD:?} ${PKGS_TO_ADD} \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && if test ! -e "${SQLITE_SRCTGZ:?}"; then (true \ + && echo "Download \"${SQLITE_URL:?}\"" \ + && curl -sSLo "${SQLITE_SRCTGZ:?}" "${SQLITE_URL:?}" \ + );fi \ + && if test ! -e "${SQLITE_BINTGZ:?}"; then (true \ + && printf '\n Build SqLite\n\n' \ + && tar xzf "${SQLITE_SRCTGZ:?}" \ + && cd sqlite-*${SQLITE_VERSION:?} \ + && mkdir build \ + && if echo $HOST|grep -q 'mingw'; then true \ + && ./configure --prefix=${PWD:?}/build --host=${HOST:?} \ + CC=${HOST_}cc CPP=$CPP CXX=$CXX BCC=gcc BEXE=.exe config_TARGET_EXEEXT=.exe \ + && ln -s mksourceid.exe mksourceid \ + && make clean && make -j$(nproc) && make install \ + && (cd build \ + && rm -rf lemon* mksourceid lib/pkgconfig lib/*.la \ + ) \ + ;else true \ + && ./configure --prefix=${PWD:?}/build \ + && make clean && make -j$(nproc) && make install \ + ;fi \ + && cp README.md LICENSE.md VERSION build/. \ + && (cd build \ + && rm -rf lib/libsqlite3.la lib/pkgconfig \ + && find -not -name MD5SUM -type f -exec md5sum -b {} + > MD5SUM \ + && tar --owner=0 --group=0 -czf "${SQLITE_BINTGZ:?}" * \ + && md5sum -b "${SQLITE_BINTGZ:?}" > "${SQLITE_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf sqlite-*${SQLITE_VERSION:?} \ + );fi \ + && printf '\n DONE\n\n' + + +## Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${SQLITE_BINTGZ:?}" \ + && true + + + diff --git a/doc/note/setup/build-zlib.txt b/doc/note/setup/build-zlib.txt new file mode 100644 index 0000000..a90e616 --- /dev/null +++ b/doc/note/setup/build-zlib.txt @@ -0,0 +1,73 @@ + +### Debian native +true \ + && PKGS_TO_ADD="curl ca-certificates gcc libc6-dev make" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && HOST= \ + && true + + +### Alpine mingw cross +true \ + && PKGS_TO_ADD="curl make mingw-w64-gcc tar" \ + && SUDO="/home/$USER/.local/bin/sudo" \ + && PKGINIT=true \ + && PKGADD="$SUDO apk add" \ + && PKGCLEAN="$SUDO apk clean" \ + && HOST=x86_64-w64-mingw32 \ + && true + + +## Generic +true \ + && ZLIB_VERSION="1.2.11" \ + && CACHE_DIR="/var/tmp" \ + && true + + +## Make +true \ + && ZLIB_URL="https://downloads.sourceforge.net/project/libpng/zlib/${ZLIB_VERSION:?}/zlib-${ZLIB_VERSION:?}.tar.gz" \ + && ZLIB_SRCTGZ="${CACHE_DIR:?}/zlib-${ZLIB_VERSION:?}.tgz" \ + && ZLIB_BINTGZ="${ZLIB_SRCTGZ%.*}-bin.tgz" \ + && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \ + && if test ! -e "${ZLIB_SRCTGZ:?}"; then (true \ + && echo "Download \"${ZLIB_URL:?}\"" \ + && curl -sSLo "${ZLIB_SRCTGZ:?}" "${ZLIB_URL:?}" \ + );fi \ + && if test ! -e "${ZLIB_BINTGZ:?}"; then (true \ + && printf '\n Build zlib\n\n' \ + && tar xzf "${ZLIB_SRCTGZ:?}" \ + && cd "zlib-${ZLIB_VERSION:?}" \ + && mkdir build \ + && if echo $HOST|grep -q '\-mingw'; then true \ + && export DESTDIR=./build BINARY_PATH=/bin INCLUDE_PATH=/include LIBRARY_PATH=/lib \ + && sed -i "s;^PREFIX =.\*\$;;" win32/Makefile.gcc \ + && make -j$(nproc) -fwin32/Makefile.gcc PREFIX=${HOST_:?} \ + && make -fwin32/Makefile.gcc install PREFIX=${HOST_:?} \ + && unset DESTDIR BINARY_PATH INCLUDE_PATH LIBRARY_PATH \ + ;else true \ + && ./configure --prefix=$PWD/build \ + && make -j$(nproc) && make install \ + ;fi \ + && cp README build/. \ + && (cd build \ + && rm -rf lib/pkgconfig \ + && tar --owner=0 --group=0 -czf "${ZLIB_BINTGZ:?}" * \ + && md5sum -b "${ZLIB_BINTGZ:?}" > "${ZLIB_BINTGZ:?}.md5" \ + ) \ + && cd .. && rm -rf "zlib-${ZLIB_VERSION:?}" \ + );fi \ + && printf '\n DONE\n\n' + + +## Install +true \ + && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${ZLIB_BINTGZ:?}" \ + && true + + + diff --git a/doc/note/setup/php-dev-server.txt b/doc/note/setup/php-dev-server.txt new file mode 100644 index 0000000..c1a8b01 --- /dev/null +++ b/doc/note/setup/php-dev-server.txt @@ -0,0 +1,48 @@ + +# PHP Dev Server + +## Setup + +true \ + && SUDO= \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGDEL="$SUDO apt purge -y" \ + && ${PKGADD:?} apt-transport-https lsb-release ca-certificates curl \ + && curl -sSL https://packages.sury.org/php/apt.gpg | $SUDO tee /etc/apt/trusted.gpg.d/php.gpg >/dev/null \ + && echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | $SUDO tee /etc/apt/sources.list.d/php.list >/dev/null \ + && $SUDO apt update \ + && ${PKGADD:?} php7.3-cli php7.3-sqlite3 \ + && $SUDO apt clean \ + && true + + +## Run + +true `# Setup common vars (host/guest)` \ + && GUESTWD=/home/user/serv \ + && GUESTSUDO=sudo \ + && CPY_INN="tmp" \ + && CPY_OUT="tmp" \ + && SSH="ssh user@localhost -p10022 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" \ + && true + +true `# Setup mounts & persistence (host)` \ + && tar c ${CPY_INN:?} | ${SSH:?} -- sh -c 'true && mkdir -p '"${GUESTWD:?}"' && cd '"${GUESTWD:?}"' && tar x' \ + && $SSH -- sh -c "true && $GUESTSUDO mount -tcifs //10.0.2.2/beef-webapp /mnt/beef-webapp" \ + && $SSH -- sh -c "true && mkdir ${GUESTWD:?}/src && $GUESTSUDO mount --bind /mnt/beef-webapp/src \"${GUESTWD:?}/src\"" \ + && true + +true `# Run dev server (guest)` \ + && cd "${GUESTWD:?}" \ + && DEBUG=1 php -dassert.bail=1 -dzend.assertions=1 -dassert.exception=1 -S 0.0.0.0:8080 src/index.php \ + && true + +true `# Copy persistence from vm back to host (host)` \ + && $SSH -- sh -c "true && cd \"${GUESTWD:?}\" && tar c \"${CPY_OUT:?}\"" | tar x \ + && true + + +## Links + +- [Install old php](https://tecadmin.net/how-to-install-php-on-debian-12/) + diff --git a/doc/note/setup/setup-android-env.txt b/doc/note/setup/setup-android-env.txt new file mode 100644 index 0000000..0008c16 --- /dev/null +++ b/doc/note/setup/setup-android-env.txt @@ -0,0 +1,85 @@ +# +# Tools for Android development. +# +# HINT: Since JDK-8 is no longer available, we have to add clutter to +# apksigner command. Eg: +# apksigner -J-add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ +# -J-add-opens=java.base/sun.security.x509=ALL-UNNAMED \ +# -J-add-opens=java.base/sun.security.pkcs=ALL-UNNAMED +# +# Refs: +# - [Clean Android HelloWorld Tutorial](https://www.hanshq.net/command-line-android.html) +# - [List of available versions](https://dl.google.com/android/repository/repository-11.xml) +# +set -e + +### Made for debian 10 (alias buster) +true \ + && PKGS_TO_ADD="curl unzip openjdk-17-jdk-headless aapt apksigner zipalign adb android-sdk-platform-tools-common" \ + && SUDO=sudo \ + && PKGINIT="$SUDO apt update" \ + && PKGADD="$SUDO apt install -y --no-install-recommends" \ + && PKGCLEAN="$SUDO apt clean" \ + && PLATFORM_VERSION="24" \ + && BUILD_TOOLS_VERSION="34.0.0" \ + && CMDLINETOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip" \ + && BUILD_TOOLS_URL="https://dl.google.com/android/repository/build-tools_r25-linux.zip" \ + && PLATFORM_URL="https://dl.google.com/android/repository/platform-${PLATFORM_VERSION:?}_r02.zip" \ + && NDK_URL="https://dl.google.com/android/repository/android-ndk-r26b-linux.zip" \ + && BUILD_TOOLS_ZIP="$(basename "${BUILD_TOOLS_URL:?}")" \ + && PLATFORM_ZIP="$(basename "${PLATFORM_URL:?}")" \ + && NDK_ZIP="$(basename "${NDK_URL:?}")" \ + \ + && $PKGINIT \ + && $PKGADD $PKGS_TO_ADD \ + && `# Cmdline tools` \ + && (cd /var/tmp && curl -sSLO "${CMDLINETOOLS_URL:?}") \ + && if test -x /tmp/cmdline-tools; then echo >&2 "[ERROR] /tmp/cmdline-tools already exists"; false; fi \ + && (cd /tmp && unzip /var/tmp/$(basename "${CMDLINETOOLS_URL:?}") >/dev/null) \ + && $SUDO mkdir /usr/lib/android-sdk/cmdline-tools \ + && $SUDO mkdir /usr/lib/android-sdk/cmdline-tools/latest \ + && (cd /tmp/cmdline-tools && tar --owner=0 --group=0 -c bin lib source.properties) | (cd /usr/lib/android-sdk/cmdline-tools/latest && $SUDO tar x) \ + && `# Build Tools` \ + && (cd /var/tmp && curl -sSL "${BUILD_TOOLS_URL:?}" -o "${BUILD_TOOLS_ZIP:?}") \ + && mkdir "/tmp/${BUILD_TOOLS_ZIP%.*}" \ + && (cd "/tmp/${BUILD_TOOLS_ZIP%.*}" && unzip "/var/tmp/${BUILD_TOOLS_ZIP:?}") \ + && (cd "/tmp/${BUILD_TOOLS_ZIP%.*}" && tar --owner=0 --group=0 -c *) \ + | (cd /usr/lib/android-sdk/build-tools && $SUDO tar x) \ + && $SUDO find /usr/lib/android-sdk/build-tools -type d -exec chmod 755 {} + \ + && `# Those for some reason are broken (wrong linker) so use the debian variant.` \ + && (cd /usr/lib/android-sdk/build-tools/android* && $SUDO rm aapt zipalign) \ + && `# Platform` \ + && (cd /var/tmp && curl -sSL "${PLATFORM_URL:?}" -o "${PLATFORM_ZIP:?}") \ + && if test -x /tmp/android*; then echo >&2 '[ERROR] /tmp/android* already exists'; false; fi \ + && (cd /tmp && unzip "/var/tmp/${PLATFORM_ZIP:?}" >/dev/null) \ + && $SUDO mkdir /usr/lib/android-sdk/platforms \ + && (cd /tmp && mv android-* "android-${PLATFORM_VERSION:?}") \ + && (cd /tmp && tar --owner=0 --group=0 -c "android-${PLATFORM_VERSION:?}") \ + | (cd /usr/lib/android-sdk/platforms && $SUDO tar x) \ + && $SUDO find /usr/lib/android-sdk/platforms/android-* -type d -exec chmod o+rx {} + \ + && $SUDO find /usr/lib/android-sdk/platforms/android-* -type f -exec chmod o+r {} + \ + && `# Environ` \ + && printf >>~/.profile '%s\n' \ + "PATH=/usr/lib/android-sdk/build-tools/debian:\$PATH" \ + "PATH=\"$(ls -d /usr/lib/android-sdk/build-tools/android-*):\$PATH\"" \ + "PATH=\"/usr/lib/android-sdk/platform-tools:\$PATH\"" \ + "PATH=\"$(ls -d /usr/lib/android-sdk/build-tools/android-*):\$PATH\"" \ + "CLASSPATH=$(ls -d /usr/lib/android-sdk/build-tools/android-*/lib/dx.jar)" \ + "LD_LIBRARY_PATH=$(ls -d /usr/lib/android-sdk/build-tools/android-*/lib64):\$LD_LIBRARY_PATH" \ + "export PATH" \ + "export CLASSPATH" \ + "export LD_LIBRARY_PATH" \ + && `# NDK` \ + && (cd /var/tmp && curl -sSL "${NDK_URL:?}" -o "${NDK_ZIP:?}") \ + && mkdir "/tmp/${NDK_ZIP%.*}" \ + && (cd "/tmp/${NDK_ZIP%.*}" && unzip "/var/tmp/${NDK_ZIP:?}") \ + && `# TODO may worth throw away some of that garbage before moving it into place` \ + && (cd "/tmp/${NDK_ZIP%.*}" && tar --owner=0 --group=0 -c android-ndk-*) \ + | (cd "/usr/lib" && $SUDO tar x) \ + && $SUDO ln -s /usr/lib/android-ndk-* "/usr/lib/android-ndk" \ + && `# Cleanup` \ + && $PKGCLEAN \ + && rm -rf /tmp/* 2>/dev/null || true \ + && printf '\n Done :)\n\n Logout and login to get your new environ from ~/.profile\n\n' \ + && true + diff --git a/doc/note/setup/setup-jni-env.txt b/doc/note/setup/setup-jni-env.txt new file mode 100644 index 0000000..62d204a --- /dev/null +++ b/doc/note/setup/setup-jni-env.txt @@ -0,0 +1,22 @@ + +# +# Debian with tools for java-native-interface development. +# +# HINT: Since migration from docker, I switched it to jdk-17 (because 11 +# seems no longer available). This change is not yet tested. +# +set -e + + +### For debian 12 +true \ + && SUDO= \ + && export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64" \ + && $SUDO apt update \ + && $SUDO apt install -y --no-install-recommends \ + g++ make openjdk-17-jdk-headless \ + && (printf '%s\n' "JAVA_HOME=${JAVA_HOME:?}" \ + ) | $SUDO tee "/etc/environment" >/dev/null \ + && $SUDO apt clean \ + && true + diff --git a/doc/note/setup/setup-jre8-env.txt b/doc/note/setup/setup-jre8-env.txt new file mode 100644 index 0000000..f39cf98 --- /dev/null +++ b/doc/note/setup/setup-jre8-env.txt @@ -0,0 +1,18 @@ + +# +# openjdk java 1.8 runtime environment. +# + +### For alpine 3.16.0 +true \ + && apk add openjdk8-jre \ + && true + +### For debian 9 +true \ + && SUDO= \ + && $SUDO apt update \ + && `# Use one of openjdk-8-jre-headless or openjdk-8-jre` \ + && $SUDO apt install -y --no-install-recommends openjdk-8-jre \ + && true + diff --git a/doc/note/setup/setup-maven-env.txt b/doc/note/setup/setup-maven-env.txt new file mode 100644 index 0000000..e4ce16d --- /dev/null +++ b/doc/note/setup/setup-maven-env.txt @@ -0,0 +1,16 @@ +# +# Maven build env. +# +# Use this to share your hosts repository with the container: +# +# mount -t cifs //10.0.2.2/path/to/.m2/repository /var/tmp/.m2/repository +# +set -e + + +### Made for alpine 3.16.0 +true \ + && apk add maven \ + && sed -i "s,, /var/tmp/.m2/repository\n,g" /usr/share/java/maven-3/conf/settings.xml \ + && true + diff --git a/doc/note/setup/setup-nginx-env.txt b/doc/note/setup/setup-nginx-env.txt new file mode 100644 index 0000000..9a5aeb2 --- /dev/null +++ b/doc/note/setup/setup-nginx-env.txt @@ -0,0 +1,48 @@ +# +# Bare nginx server serving HTTP/80 and HTTPS/443. +# +set -e + + +### Made for alpine 3.16.0 +true \ + && CN="example.com" \ + \ + && apk add nginx openssl \ + && mkdir /etc/ssl/private \ + && openssl genrsa -out /etc/ssl/private/nginx.key 2048 \ + && openssl req -new -key /etc/ssl/private/nginx.key \ + -out /etc/ssl/private/nginx.csr \ + -subj "/C=/ST=/L=/O=/OU=/CN=${CN:?}" \ + && openssl x509 -req -days 365 -in /etc/ssl/private/nginx.csr \ + -signkey /etc/ssl/private/nginx.key -out /etc/ssl/certs/nginx.crt \ + && chgrp nginx /etc/ssl/private/nginx.key \ + && chmod 0640 /etc/ssl/private/nginx.key \ + && printf '%s\n' \ + 'server {' \ + ' listen 80 default_server;' \ + ' listen [::]:80 default_server;' \ + ' listen 443 ssl default_server;' \ + ' listen [::]:443 default_server;' \ + ' ssl_certificate /etc/ssl/certs/nginx.crt;' \ + ' ssl_certificate_key /etc/ssl/private/nginx.key;' \ + ' location / {' \ + ' root /srv/www;' \ + ' index index.html index.htm;' \ + ' }' \ + '}' \ + > /etc/nginx/http.d/default.conf \ + && mkdir /srv/www \ + && printf '

Nginx says hi

\n' > /srv/www/index.html \ + && chown nginx:nginx /srv/www \ + && chown nginx:nginx /srv/www/index.html \ + && apk del openssl \ + && `# Configure nginx as a service` \ + && rc-update add nginx \ + && /etc/init.d/nginx start \ + && sleep 1 \ + && echo \ + && printf 'GET /index.html HTTP/1.0\r\n\r\n'|nc localhost 80 \ + && echo \ + && true + diff --git a/doc/note/setup/setup-windoof.txt b/doc/note/setup/setup-windoof.txt new file mode 100644 index 0000000..5df2cac --- /dev/null +++ b/doc/note/setup/setup-windoof.txt @@ -0,0 +1,40 @@ + +Setup Windoof in a experiment VM +================================ + +Install system STRICTLY WITHOUT internet connection. + +Stop annoying windoof auto updates. Make sure to use windoof newlines (CRLF) in +the reg file: + + +Windows Registry Editor Version 5.00 +[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] +"NoAutoUpdate"=dword:00000001 + +curl -sSD- http://10.0.2.9:80/stop-annoying-updates.reg -O + +After running "reg" file, we can reboot windoof with internet connection. + +Download/Install: +- "https://learn.microsoft.com/en-us/sysinternals/downloads/sdelete" +- "https://notepad-plus-plus.org/" + +Install needed software (Maybe: firefox, MsOffice, MsTeams, ..?). + +Manually trigger updates, reboot, updates, reboot, (likely some more turns ...) + +Configure Performance options. Disable all but screen fonts. + +Make sure no more updates are running. Then, I guess best is to reboot without +internet access once more to cleanup the disk. Delete unused files like +trashcan or downloaded installers: + + SDelete.exe -nobanner -z C: + +Shutdown win guest, then compact disc. + + qemu-img convert -O qcow2 input.qcow output.qcow2 + +Image is ready. + -- cgit v1.1 From f1cbafcfc08349366b6e8e26349e0c9596e318bb Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 28 Sep 2024 17:49:06 +0200 Subject: Continue qemu docker microVM setup. --- doc/note/docker/Docker-Daemon-Install.txt | 36 ++++++------ doc/note/qemu/docker-microVM.txt | 97 ++++++++++++++++++++++++++----- 2 files changed, 100 insertions(+), 33 deletions(-) diff --git a/doc/note/docker/Docker-Daemon-Install.txt b/doc/note/docker/Docker-Daemon-Install.txt index 1bfa6bb..0bbe7eb 100644 --- a/doc/note/docker/Docker-Daemon-Install.txt +++ b/doc/note/docker/Docker-Daemon-Install.txt @@ -1,26 +1,23 @@ -How to install a docker daemon eg in a VM or so -=============================================== +How to install docker daemon on debian +====================================== -Setup a VM (eg debian bullseye) +Set proxy settings in environ if needed. -Add auth proxy in "/etc/environment" -Make sure "apt update" works. + && SUDO=sudo \ + && $SUDO apt install -y --no-install-recommends ca-certificates curl gnupg lsb-release \ + && `# TODO what is this step for? ` \ + && `# sudo install -m 0755 -d /etc/apt/keyrings ` \ + && $SUDO curl -fsSL -o /etc/apt/keyrings/docker.asc 'https://download.docker.com/linux/debian/gpg' \ + && $SUDO chmod a+r /etc/apt/keyrings/docker.asc + && printf %s\\n \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc]" \ + "https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \ + | $SUDO tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && $SUDO apt update \ + && $SUDO apt install -y --no-install-recommends docker-ce docker-ce-cli containerd.io \ -Install docker as described on "https://docs.docker.com/engine/install/debian/" - - sudo apt update - sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg lsb-release - - # I had to download that gpg on my host and then pasting it into the vm - # to use it there - curl -sSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - - sudo apt update - sudo apt install -y --no-install-recommends docker-ce docker-ce-cli containerd.io Edit "/lib/systemd/system/docker.service" and add environ config in "service" section (HINT: "/etc/environment" does not work) @@ -50,4 +47,7 @@ HINT: Maybe 'insecure' not needed, ToBeTested. +## Links + +[Install Docker Engine on Debian](https://docs.docker.com/engine/install/debian/) diff --git a/doc/note/qemu/docker-microVM.txt b/doc/note/qemu/docker-microVM.txt index 9bbcff7..378dac7 100644 --- a/doc/note/qemu/docker-microVM.txt +++ b/doc/note/qemu/docker-microVM.txt @@ -2,7 +2,13 @@ # # Use qemu to host dockerimages. # -# [Execute Docker Containers as QEMU MicroVMs](https://mergeboard.com/blog/2-qemu-microvm-docker/) +# TODO: Write helpers to pull/convert docker image to qcow2 +# TODO: Impl host shared dirs. Should be possible using 9pfs (see link). +# +# for "virt-make-fs" install "guestfs-tools". +# +# Some Links: +# - [Execute Docker Containers as QEMU MicroVMs](https://mergeboard.com/blog/2-qemu-microvm-docker/) # true \ @@ -65,22 +71,83 @@ EOF true \ && make olddefconfig \ && make -j$(nproc) \ - && base64 -d < "${CACHEDIR:?}/gagainit.c" && -H4sIACTh02UAA41UTYvbMBC9+1cIlwY7JKtsYSlsNoVSAj1s0x62pzQsijxORCzJq4+wacl/35Ed -u85HS3ywnp5n5j2NJNP+3Bq+SNbOlfaeUglmBUvNTHbDtaTLQq/oh+ELSD+Ughu9lcNM8w0YmvZp -9E4oXvgMyAMYo/TN+lOHsi4T51QhlsecVwLpk7idpVJ75c5p69h/2IivmSF9rpV1JIOc+cI9g9oK -o5UE5eYLMiF/IoJP/OPz09cJ9dbQQnNW0KVQ952pbectqKnqFWA8qArNfj4+DqL9OIq2WmSk8v3M -18A3SfW9NlMbs9obDoMjzjFsuRucxeaiAFybA+l2JeZ4ZcVKQUYKrVa1TF6wle1mVg76GXMsSg/r -tM547kjoEBEq1+gz0CInSeCSgzzphY8pmUzI8Jb0eqTa0TCdzr5PZ09NufCURqB2En8xwJxAM+/t -L+wGqUul4zYwiMhNJkyrMvp4d5eSBzLq1qtqop42nZqYBdxpsyM5w05kcadueOBVuOS2Q+6j+h11 -LX4LbfqXxcpeCEiafWlsnva+020Sunu2hMZ+pXfB8ZHbfYQu0R+RTKgkAJTlg8O+I97OF03x7nGK -lVaAi4hpaTQP4DCOEDZqlxMy2NLS2YAR1ui6LPniwVfTFl2XaNcyYCfL/Do1bHgYcbg+geaW8pXR -vgxMi5rc+gaAW2vrFJOQxIe/GMZY8Rt0/pdJm3h4BV5gaLjpuIpKqoXVbb/0azk4bQ7CFIucnAMD -zhtFbse4/W9r76rneAUAAA== + && `# Create our own pseudo 'init' system` \ + && `# TODO fix zombie processes (aka add waitpid() SIGCHILD handling to init)` \ + && mkdir "${WORKDIR:?}/myinit" \ + && cd "${WORKDIR:?}/myinit" \ + && base64 -d < "./myinit.c" && +H4sIAIsP+GYAA41Uy27bMBC88ysWKmrIgVvZh6BAHRcoCgM9pG4P6SkNAoZa2UQkUuXDiFv437Ok +LEV+JDAP0nC0uzNckmLvpBKlzxGu0BilP66+sBfKulweU6V82Oe8kkQfxG1sVmmv3DFtHX+DZWLF +DVwIrayDHAvuS3ePai2NVhUqd3sHM/jPgEby6+vN91nmrclKLXiZPUj1uTe13bwDDRUfASajWGjx ++/p6xLZTxtZa5hB934sVisc0fm/MNMas9kbgaI9z3CzRjY5iC1kirc1h5TY15Xhl5VJhDqVWy0am +KPnS9jOjg4ucO86Gu3VaZ7xwEDoEUhWafAZaFpAGLt3JwyB8HMJsBh8mMBhA3NEwnS9+zhc3bbkw +aiNJO02+GeROkpn39g91A5pSw2kXGESqx1yaTmX86fJyCFcw7teLNUlPm15NykLhtNlAwakTedKr +GwY+SZdOeuSWNU/Wt/gjtOk1i9FeCEjbfWltHva+120I3T1aQms/6p1wvOd2y8gl+YOKS5UGQLJi +tNt3wuvbu7Z4/zglSiukRSRZbbQIYPceE2zVTifkuM5qZwMm2KDzsqq/Hn2cdui8RLuqAnZVXZyn +Rg0Pb3qdn5AVNhNLo30dmA61uc0NQLfS1ileYZpUUhi9Ds6s/Ie6eGGGbTw+oSgpNNx0WkWU6mC8 +7ad+LTun7UGYU5GDc2DQeaNgMg3b/wwcaf4fPAUAAA== EOF true \ - && gcc -Wall -static -o "${CACHEDIR:?}/gagainit" "${CACHEDIR:?}/gagainit.c" \ + && CFLAGS="-Wall -Werror -pedantic -static" `# TODO maybe add "-Os -s"` \ + && gcc -o myinit myinit.c ${CFLAGS?}\ && echo "[ERROR] TODO Need more steps here" && false \ - && true + && echo _script_is_DONE_kx1n2kgNWRdpBYTP_ \ + + + + + +## Test launch pure kernel (kernel panic expected) + +qemu-system-x86_64 \ + -M microvm,x-option-roms=off,isa-serial=off,rtc=off -no-acpi -cpu host \ + -accel kvm -nodefaults -no-user-config -nographic -no-reboot \ + -device virtio-serial-device \ + -chardev stdio,id=virtiocon0 -device virtconsole,chardev=virtiocon0 \ + -kernel kernel/bzImage -append "console=hvc0 acpi=off reboot=t panic=-1" \ + ; + + +## Test launch full VM + +KERNEL="${WORKDIR:?}/linux-*/arch/x86_64/boot/bzImage" +HOST_SHARE_DIR="/path/to/host/share" +QEMU_IMAGE="dockerimage.qcow2" +qemu-system-x86_64 \ + -M microvm,x-option-roms=off,isa-serial=off,rtc=off -no-acpi -no-reboot \ + -accel kvm -cpu host -nodefaults -no-user-config -nographic \ + -m 1G -smp $(nproc) \ + -device virtio-serial-device \ + -chardev stdio,id=virtiocon0 -device virtconsole,chardev=virtiocon0 \ + -kernel "${KERNEL:?}" \ + -append "console=hvc0 root=/dev/vda rw acpi=off reboot=t panic=-1 quiet" \ + -drive id=root,file=${QEMU_IMAGE:?},format=qcow2,if=none \ + -device virtio-blk-device,drive=root \ + -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80 \ + -device virtio-net-device,netdev=mynet0 \ + -fsdev local,path=${HOST_SHARE_DIR:?},security_model=none,id=www,readonly=on \ + -device virtio-9p-device,fsdev=www,mount_tag=www \ + -device virtio-rng-device + ; + + +## Example docker image transformation + + && rm -rf "${WORKDIR:?}/dockerbuild" \ + && mkdir "${WORKDIR:?}/dockerbuild" \ + && cd "${WORKDIR:?}/dockerbuild" \ + && cp "${WORKDIR:?}/myinit/myinit" init \ + && base64 -d < "Dockerfile" && +H4sIAMsc+GYAA3ML8vdVyEvPzKuwMtQzMtQz4AoK9VNILChRKC1ISSxJhXMz84pLEnNyFHQrFTKL +k3VTMpILdJNzMlPzSsBKinIVdNMU9IuTMvP0M/MyS7ic/QMiFUAsZEEAfPYPR24AAAA= +EOF +true \ + && DOCKER_BUILDKIT=1 docker build -f ./Dockerfile --output "type=tar,dest=dockerimage.tar" . \ + && virt-make-fs --format=qcow2 --size=+200M dockerimage.tar dockerimage-large.qcow2 \ + && qemu-img convert dockerimage-large.qcow2 -O qcow2 dockerimage.qcow2 \ + && rm dockerimage-large.qcow2 \ + + + -- cgit v1.1 From 05ea7803703f0aa6224ee452470ca42f5621b7f3 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 28 Sep 2024 17:57:03 +0200 Subject: qemu docker VM: Note how to host share mount works. --- doc/note/qemu/docker-microVM.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/note/qemu/docker-microVM.txt b/doc/note/qemu/docker-microVM.txt index 378dac7..98712c0 100644 --- a/doc/note/qemu/docker-microVM.txt +++ b/doc/note/qemu/docker-microVM.txt @@ -113,6 +113,7 @@ qemu-system-x86_64 \ KERNEL="${WORKDIR:?}/linux-*/arch/x86_64/boot/bzImage" HOST_SHARE_DIR="/path/to/host/share" QEMU_IMAGE="dockerimage.qcow2" +# mount share from guest: mount -t 9p myMountTag /mnt/share -otrans=virtio,version=9p2000.L,msize=52428800 qemu-system-x86_64 \ -M microvm,x-option-roms=off,isa-serial=off,rtc=off -no-acpi -no-reboot \ -accel kvm -cpu host -nodefaults -no-user-config -nographic \ @@ -126,7 +127,7 @@ qemu-system-x86_64 \ -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80 \ -device virtio-net-device,netdev=mynet0 \ -fsdev local,path=${HOST_SHARE_DIR:?},security_model=none,id=www,readonly=on \ - -device virtio-9p-device,fsdev=www,mount_tag=www \ + -device virtio-9p-device,fsdev=www,mount_tag=myMountTag \ -device virtio-rng-device ; -- cgit v1.1 From c4684f64e8c5a6462c3a2cc8c00c495200cf6a83 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 28 Sep 2024 20:09:47 +0200 Subject: continue qemu-docker-microVM --- doc/note/qemu/docker-microVM.txt | 106 ++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/doc/note/qemu/docker-microVM.txt b/doc/note/qemu/docker-microVM.txt index 98712c0..c3bd0d5 100644 --- a/doc/note/qemu/docker-microVM.txt +++ b/doc/note/qemu/docker-microVM.txt @@ -1,15 +1,13 @@ -# -# Use qemu to host dockerimages. -# -# TODO: Write helpers to pull/convert docker image to qcow2 -# TODO: Impl host shared dirs. Should be possible using 9pfs (see link). -# -# for "virt-make-fs" install "guestfs-tools". -# -# Some Links: -# - [Execute Docker Containers as QEMU MicroVMs](https://mergeboard.com/blog/2-qemu-microvm-docker/) -# +Use qemu to host dockerimages. +============================== + +TODO: Write helpers to pull/convert docker image to qcow2 +TODO: Impl host shared dirs. Should be possible using 9pfs (see link). + +For "virt-make-fs" install "guestfs-tools". + +WARN: This is work-in-progress. It is NOT really usable yet. true \ && LINUX_URL=https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz \ @@ -75,18 +73,16 @@ true \ && `# TODO fix zombie processes (aka add waitpid() SIGCHILD handling to init)` \ && mkdir "${WORKDIR:?}/myinit" \ && cd "${WORKDIR:?}/myinit" \ - && base64 -d < "./myinit.c" && -H4sIAIsP+GYAA41Uy27bMBC88ysWKmrIgVvZh6BAHRcoCgM9pG4P6SkNAoZa2UQkUuXDiFv437Ok -LEV+JDAP0nC0uzNckmLvpBKlzxGu0BilP66+sBfKulweU6V82Oe8kkQfxG1sVmmv3DFtHX+DZWLF -DVwIrayDHAvuS3ePai2NVhUqd3sHM/jPgEby6+vN91nmrclKLXiZPUj1uTe13bwDDRUfASajWGjx -+/p6xLZTxtZa5hB934sVisc0fm/MNMas9kbgaI9z3CzRjY5iC1kirc1h5TY15Xhl5VJhDqVWy0am -KPnS9jOjg4ucO86Gu3VaZ7xwEDoEUhWafAZaFpAGLt3JwyB8HMJsBh8mMBhA3NEwnS9+zhc3bbkw -aiNJO02+GeROkpn39g91A5pSw2kXGESqx1yaTmX86fJyCFcw7teLNUlPm15NykLhtNlAwakTedKr -GwY+SZdOeuSWNU/Wt/gjtOk1i9FeCEjbfWltHva+120I3T1aQms/6p1wvOd2y8gl+YOKS5UGQLJi -tNt3wuvbu7Z4/zglSiukRSRZbbQIYPceE2zVTifkuM5qZwMm2KDzsqq/Hn2cdui8RLuqAnZVXZyn -Rg0Pb3qdn5AVNhNLo30dmA61uc0NQLfS1ileYZpUUhi9Ds6s/Ie6eGGGbTw+oSgpNNx0WkWU6mC8 -7ad+LTun7UGYU5GDc2DQeaNgMg3b/wwcaf4fPAUAAA== -EOF + && base64 -d < "./myinit.c" && +H4sIABBA+GYAA41UTY/TMBC951eMgqiSqGzawwqJbpEQFIG0tBzKCRDKOk5ibWIHj1PRRf3vjJ2PZtsK1Yf4+WXmzfOn90JIVjY +phzuutVQ3xVvvSKFJxTlViofnXCMF0Sdxe4wr1UhzTqNJ/sN6FggGrEg0RExJNKAavZI7oZX8/hOW8NcDav7Xd9tPy7hBHZeKJW +X8IOSb0RCH8QBayn0s9KdOaP3t/n7qHRZD6Z0SKTjzv1jB2WPgwpwh5ydCzabjcYpmehqT4XZf8ymUSubQSBS55KQqzccyxzba1 +Wmjid/UBr2wmxwa3TAD1hAImamFY0UWOCqwBWFif4SwXMKrOUwm4DbQDlfrzWq9hbCVsq3WQpos8N9rTjMkQy/xB00fSCdcDFFW +vnpMhW71Z69vb0O4g9lYyalRJaVHapTCmVF6D1kiSp76I1Hb+B9hgvmIPHjHb+/ti13wi96cL/s3cAvvzPXL2y8odCt4Zrg36+Q +v+Hvm7eAdPI/sQJUIGYBFic67zY4iwrtee3w+fKkkJ8t+XGvFLOj6GcG+2OWElO9ism0xwRZdl1X9bnjjhgO6LhGLymJT1dl11e +h62p666xPiDGOWa9XUlhnQOBe5KRQamVQ88CvBtNpZYyieuMqOTNiFx9F282EDnyFvOCKYQiBgwcsSkGlRG9rJmk4hkaridtswi +r12hzkrqYS9+DR553AE7UsQCynMjSPcazB6cbrq/TFakdjJKdLcNFrCfGEPzz+XOnXTUQUAAA== +EOF_jXxQDgrLcOFqcSrh true \ && CFLAGS="-Wall -Werror -pedantic -static" `# TODO maybe add "-Os -s"` \ && gcc -o myinit myinit.c ${CFLAGS?}\ @@ -94,25 +90,47 @@ true \ && echo _script_is_DONE_kx1n2kgNWRdpBYTP_ \ +## Example docker image transformation + && rm -rf "${WORKDIR:?}/dockerbuild" \ + && mkdir "${WORKDIR:?}/dockerbuild" \ + && cd "${WORKDIR:?}/dockerbuild" \ + && cp "${WORKDIR:?}/myinit/myinit" init \ + && base64 -d < "Dockerfile" && +H4sIANRD+GYAA21R226CQBR89ytO0sQXgwp4ow9NEMSqWMAbhfTBBVZZxQXZ9Ub68VUTU5v0PE1mziRn5hgTawx0Tej5VaxKYrV +emsw/gOcHDF8lgHIZUMbhkEWI/2EIZRwlCQgXICwUojjMhDAhmHJYvsDM0i3I8S49YuAxYcuHFYdxCu8NNlDHkV7pe6p6cS3m5N +q4OzEUuTASp+WjTU2dT+ph3nNbmtY4Y1fSlNF8a0p6Td53T3xtU3kXfB6doSwhJnZ9b4gJ0Uwf9WbG0JWs9YDGA8VFrJ+eOr6xM +ubGgm3OPV/zx87Q5KmceefCVhqrU0WebgqdheYFL+xINoP+NvBEEWUdBavtjjPjulW3TbMYRHyUHY9Jvu/NptfDVfUe6j7fECCG +Ww0QoiteFyS7oTeosYDQGqGEV1n86CCMd2kE7WbzfznfgbB6kp5bDxOM6IO4PamkWbYH97VfR+kHD2L339UBAAA= +EOF_BSgBW2SBUEB7zcJv +true \ + && DOCKER_BUILDKIT=1 $SUDO docker build -f ./Dockerfile --output "type=tar,dest=dockerimage.tar" . \ + && virt-make-fs --format=qcow2 --size=+200M dockerimage.tar dockerimage-large.qcow2 \ + && qemu-img convert dockerimage-large.qcow2 -O qcow2 dockerimage.qcow2 \ + && rm dockerimage-large.qcow2 \ -## Test launch pure kernel (kernel panic expected) +## Collect created resources -qemu-system-x86_64 \ - -M microvm,x-option-roms=off,isa-serial=off,rtc=off -no-acpi -cpu host \ - -accel kvm -nodefaults -no-user-config -nographic -no-reboot \ - -device virtio-serial-device \ - -chardev stdio,id=virtiocon0 -device virtconsole,chardev=virtiocon0 \ - -kernel kernel/bzImage -append "console=hvc0 acpi=off reboot=t panic=-1" \ - ; +Likely to be run on qemu HOST, to get needed resources out of VM to host +to start VMs from it later. + + && WORKDIRHOST="path/to/where/you/want/the/files" \ + && WORKDIRGUEST="/home/user/work" \ + && SSH=ssh \ + && cd "${WORKDIRHOST:?}" \ + && ${SSH:?} -oRemoteCommand='tar --owner=0 --group=0 -ch -C "'"${WORKDIRGUEST:?}"'/myinit" myinit -C "'"${WORKDIRGUEST:?}"'/linux-6.7.4/arch/x86_64/boot" bzImage -C "'"${WORKDIRGUEST:?}"'/dockerbuild" dockerimage.qcow2' \ + | tar -C "${WORKDIRHOST:?}" -x \ + && mv myinit init \ + && mv bzImage kernel \ + && mv dockerimage.qcow2 hda.qcow2 \ ## Test launch full VM -KERNEL="${WORKDIR:?}/linux-*/arch/x86_64/boot/bzImage" +KERNEL=kernel HOST_SHARE_DIR="/path/to/host/share" -QEMU_IMAGE="dockerimage.qcow2" +QEMU_IMAGE="hda.qcow2" # mount share from guest: mount -t 9p myMountTag /mnt/share -otrans=virtio,version=9p2000.L,msize=52428800 qemu-system-x86_64 \ -M microvm,x-option-roms=off,isa-serial=off,rtc=off -no-acpi -no-reboot \ @@ -124,31 +142,17 @@ qemu-system-x86_64 \ -append "console=hvc0 root=/dev/vda rw acpi=off reboot=t panic=-1 quiet" \ -drive id=root,file=${QEMU_IMAGE:?},format=qcow2,if=none \ -device virtio-blk-device,drive=root \ - -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80 \ + -netdev user,id=mynet0 \ -device virtio-net-device,netdev=mynet0 \ -fsdev local,path=${HOST_SHARE_DIR:?},security_model=none,id=www,readonly=on \ -device virtio-9p-device,fsdev=www,mount_tag=myMountTag \ - -device virtio-rng-device + -device virtio-rng-device \ ; -## Example docker image transformation - - && rm -rf "${WORKDIR:?}/dockerbuild" \ - && mkdir "${WORKDIR:?}/dockerbuild" \ - && cd "${WORKDIR:?}/dockerbuild" \ - && cp "${WORKDIR:?}/myinit/myinit" init \ - && base64 -d < "Dockerfile" && -H4sIAMsc+GYAA3ML8vdVyEvPzKuwMtQzMtQz4AoK9VNILChRKC1ISSxJhXMz84pLEnNyFHQrFTKL -k3VTMpILdJNzMlPzSsBKinIVdNMU9IuTMvP0M/MyS7ic/QMiFUAsZEEAfPYPR24AAAA= -EOF -true \ - && DOCKER_BUILDKIT=1 docker build -f ./Dockerfile --output "type=tar,dest=dockerimage.tar" . \ - && virt-make-fs --format=qcow2 --size=+200M dockerimage.tar dockerimage-large.qcow2 \ - && qemu-img convert dockerimage-large.qcow2 -O qcow2 dockerimage.qcow2 \ - && rm dockerimage-large.qcow2 \ - +## Refs +- [Execute Docker Containers as QEMU MicroVMs](https://mergeboard.com/blog/2-qemu-microvm-docker/) -- cgit v1.1 From 282de8158508f260fe1ea542492616049f672ac7 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sat, 28 Sep 2024 23:45:09 +0200 Subject: Add how to conditionally insert in sqlite query --- doc/note/sqlite/sqlite.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/note/sqlite/sqlite.txt b/doc/note/sqlite/sqlite.txt index 3805e07..ddcc0ae 100644 --- a/doc/note/sqlite/sqlite.txt +++ b/doc/note/sqlite/sqlite.txt @@ -26,6 +26,13 @@ csv Example (no headrow): sqlite3 foo.db -bail -cmd '.mode csv' -cmd '.separator ;' -cmd '.import foo.csv FooTable' +## Insert conditional + +INSERT INTO table(id, text) +SELECT 5, 'text to insert' +WHERE NOT EXISTS (SELECT 1 FROM table WHERE id = 5) + + ## Drop Column ALTER TABLE table DROP COLUMN column; @@ -39,4 +46,5 @@ csv Example (no headrow): ## Refs [drop column TODO vote](https://stackoverflow.com/a/66399224/4415884) +[insert if not exists](https://stackoverflow.com/a/19337206/4415884) -- cgit v1.1 From caf8fe34a85facf4edad8930015fbe9ae3d5f7b6 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Sun, 29 Sep 2024 22:11:30 +0200 Subject: Add 'ntp' to debian setup, so system time gets auto-adjusted. --- doc/note/setup/setup-debian.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/note/setup/setup-debian.txt b/doc/note/setup/setup-debian.txt index 1924e34..202fec7 100644 --- a/doc/note/setup/setup-debian.txt +++ b/doc/note/setup/setup-debian.txt @@ -94,7 +94,7 @@ Populate "/etc/environment" as described by "./etc-environment". && $SUDO apt install -y --no-install-recommends \ `# basic CLI` \ vim htop pv openssh-client iptables iptables-persistent xxd zip unzip xz-utils p7zip-full \ - file trash-cli ncat curl \ + file trash-cli ncat curl ntp \ `# basic UI (vim-gtk required for system clipboard)` \ vim-gtk3 firefox-esr pcmanfm file-roller thunderbird chromium okular \ `# software devel` \ -- cgit v1.1