docs(readme): update

This commit is contained in:
2025-05-13 21:48:16 -07:00
parent a0436819c4
commit 3036953e4a
2 changed files with 54 additions and 250 deletions

View File

@@ -368,7 +368,7 @@ This repository offers two types of docker image; `stable` and `development`. Yo
| Build | Tags | | Build | Tags |
| ------------------------- | ----------------------------------------------------------------------------- | | ------------------------- | ----------------------------------------------------------------------------- |
| `Stable` | `🔖 tvapp2:latest` <br /> `🔖 tvapp2:1.5.0` <br /> `🔖 tvapp2:1.5` <br /> `🔖 tvapp2:1` | | `Stable` | `🔖 tvapp2:latest` <br /> `🔖 tvapp2:1.5.2` <br /> `🔖 tvapp2:1.5` <br /> `🔖 tvapp2:1` |
| `Development` | `🔖 tvapp2:development` | | `Development` | `🔖 tvapp2:development` |
<br /> <br />
@@ -580,18 +580,19 @@ Creates the TVApp2 `amd64` docker image:
# Build tvapp2 amd64 # Build tvapp2 amd64
docker buildx build \ docker buildx build \
--build-arg ARCH=amd64 \ --build-arg ARCH=amd64 \
--build-arg VERSION=1.5.0 \ --build-arg VERSION=1.5.2 \
--build-arg BUILDDATE=20260812 \ --build-arg BUILDDATE=20260812 \
--build-arg RELEASE=stable \ --build-arg RELEASE=stable \
--tag ghcr.io/thebinaryninja/tvapp2:1.5.0 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5.2 \
--tag ghcr.io/thebinaryninja/tvapp2:1.5 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5 \
--tag ghcr.io/thebinaryninja/tvapp2:1 \ --tag ghcr.io/thebinaryninja/tvapp2:1 \
--tag ghcr.io/thebinaryninja/tvapp2:latest \ --tag ghcr.io/thebinaryninja/tvapp2:latest \
--attest type=provenance,disabled=true \ --attest type=provenance,disabled=true \
--attest type=sbom,disabled=true \ --attest type=sbom,disabled=true \
--output type=docker \
--builder default \
--file Dockerfile \ --file Dockerfile \
--platform linux/amd64 \ --platform linux/amd64 \
--output type=docker \
--allow network.host \ --allow network.host \
--network host \ --network host \
--no-cache \ --no-cache \
@@ -609,18 +610,19 @@ Creates the TVApp2 `arm64` docker image:
# Build tvapp2 arm64 # Build tvapp2 arm64
docker buildx build \ docker buildx build \
--build-arg ARCH=arm64 \ --build-arg ARCH=arm64 \
--build-arg VERSION=1.5.0 \ --build-arg VERSION=1.5.2 \
--build-arg BUILDDATE=20260812 \ --build-arg BUILDDATE=20260812 \
--build-arg RELEASE=stable \ --build-arg RELEASE=stable \
--tag ghcr.io/thebinaryninja/tvapp2:1.5.0 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5.2 \
--tag ghcr.io/thebinaryninja/tvapp2:1.5 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5 \
--tag ghcr.io/thebinaryninja/tvapp2:1 \ --tag ghcr.io/thebinaryninja/tvapp2:1 \
--tag ghcr.io/thebinaryninja/tvapp2:latest \ --tag ghcr.io/thebinaryninja/tvapp2:latest \
--attest type=provenance,disabled=true \ --attest type=provenance,disabled=true \
--attest type=sbom,disabled=true \ --attest type=sbom,disabled=true \
--output type=docker \
--builder default \
--file Dockerfile \ --file Dockerfile \
--platform linux/arm64 \ --platform linux/arm64 \
--output type=docker \
--allow network.host \ --allow network.host \
--network host \ --network host \
--no-cache \ --no-cache \
@@ -742,8 +744,8 @@ docker run --privileged --rm tonistiigi/binfmt --install all
Once the emulator is installed; we will now build two images. When building these two images; we will ensure the `--tag` value is different for each one, by adding the architecture to the end. This ensures we don't overwrite one image with the newer one. We need to have two seperate docker images with two different tags. Once the emulator is installed; we will now build two images. When building these two images; we will ensure the `--tag` value is different for each one, by adding the architecture to the end. This ensures we don't overwrite one image with the newer one. We need to have two seperate docker images with two different tags.
- `--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64` - `--tag ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64`
- `--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64` - `--tag ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64`
<br /> <br />
@@ -754,10 +756,10 @@ Once the emulator is installed; we will now build two images. When building thes
> >
> | Registry | Tag | > | Registry | Tag |
> | --- | --- | > | --- | --- |
> | Dockerhub | `--tag thebinaryninja/tvapp2:1.5.0-amd64`<br>`--tag thebinaryninja/tvapp2:1.5.0-arm64` | > | Dockerhub | `--tag thebinaryninja/tvapp2:1.5.2-amd64`<br>`--tag thebinaryninja/tvapp2:1.5.2-arm64` |
> | Github (GHCR) | `--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64`<br>`--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64` | > | Github (GHCR) | `--tag ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64`<br>`--tag ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64` |
> | Registry v2 | `--tag registry.domain.lan/thebinaryninja/tvapp2:1.5.0-amd64`<br>`--tag registry.domain.lan/thebinaryninja/tvapp2:1.5.0-arm64` | > | Registry v2 | `--tag registry.domain.lan/thebinaryninja/tvapp2:1.5.2-amd64`<br>`--tag registry.domain.lan/thebinaryninja/tvapp2:1.5.2-arm64` |
> | Gitea | `--tag git.binaryninja.net/binaryninja/tvapp2:1.5.0-amd64`<br>`--tag git.binaryninja.net/binaryninja/tvapp2:1.5.0-arm64` | > | Gitea | `--tag git.binaryninja.net/binaryninja/tvapp2:1.5.2-amd64`<br>`--tag git.binaryninja.net/binaryninja/tvapp2:1.5.2-arm64` |
<br /> <br />
@@ -778,21 +780,24 @@ Creates the TVApp2 **Stable** release `amd64` docker image:
# Build Tvapp2 amd64 - (stable release) # Build Tvapp2 amd64 - (stable release)
docker buildx build \ docker buildx build \
--build-arg ARCH=amd64 \ --build-arg ARCH=amd64 \
--build-arg VERSION=1.5.0 \ --build-arg VERSION=1.5.2 \
--build-arg BUILDDATE=20260812 \ --build-arg BUILDDATE=20260812 \
--build-arg RELEASE=stable \ --build-arg RELEASE=stable \
--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64 \
--attest type=provenance,disabled=true \ --attest type=provenance,disabled=true \
--attest type=sbom,disabled=true \ --attest type=sbom,disabled=true \
--output type=docker \
--builder default \
--file Dockerfile \ --file Dockerfile \
--platform linux/amd64 \ --platform linux/amd64 \
--output type=docker \
--allow network.host \ --allow network.host \
--network host \ --network host \
--no-cache \ --no-cache \
--pull \ --pull \
--push \ --push \
. .
``` ```
<br /> <br />
@@ -805,15 +810,16 @@ Creates the TVApp2 **Stable** release `arm64` docker image:
# Build Tvapp2 arm64 - (stable release) # Build Tvapp2 arm64 - (stable release)
docker buildx build \ docker buildx build \
--build-arg ARCH=arm64 \ --build-arg ARCH=arm64 \
--build-arg VERSION=1.5.0 \ --build-arg VERSION=1.5.2 \
--build-arg BUILDDATE=20260812 \ --build-arg BUILDDATE=20260812 \
--build-arg RELEASE=stable \ --build-arg RELEASE=stable \
--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64 \
--attest type=provenance,disabled=true \ --attest type=provenance,disabled=true \
--attest type=sbom,disabled=true \ --attest type=sbom,disabled=true \
--output type=docker \
--builder default \
--file Dockerfile \ --file Dockerfile \
--platform linux/arm64 \ --platform linux/arm64 \
--output type=docker \
--allow network.host \ --allow network.host \
--network host \ --network host \
--no-cache \ --no-cache \
@@ -832,15 +838,16 @@ Creates the TVApp2 **Development** release `amd64` docker image:
# Build Tvapp2 amd64 - (development release) # Build Tvapp2 amd64 - (development release)
docker buildx build \ docker buildx build \
--build-arg ARCH=amd64 \ --build-arg ARCH=amd64 \
--build-arg VERSION=1.5.0 \ --build-arg VERSION=1.5.2 \
--build-arg BUILDDATE=20260812 \ --build-arg BUILDDATE=20260812 \
--build-arg RELEASE=development \ --build-arg RELEASE=development \
--tag ghcr.io/thebinaryninja/tvapp2:development-amd64 \ --tag ghcr.io/thebinaryninja/tvapp2:development-amd64 \
--attest type=provenance,disabled=true \ --attest type=provenance,disabled=true \
--attest type=sbom,disabled=true \ --attest type=sbom,disabled=true \
--output type=docker \
--builder default \
--file Dockerfile \ --file Dockerfile \
--platform linux/amd64 \ --platform linux/amd64 \
--output type=docker \
--allow network.host \ --allow network.host \
--network host \ --network host \
--no-cache \ --no-cache \
@@ -859,15 +866,16 @@ Creates the TVApp2 **Development** release `arm64` docker image:
# Build Tvapp2 arm64 - (development release) # Build Tvapp2 arm64 - (development release)
docker buildx build \ docker buildx build \
--build-arg ARCH=arm64 \ --build-arg ARCH=arm64 \
--build-arg VERSION=1.5.0 \ --build-arg VERSION=1.5.2 \
--build-arg BUILDDATE=20260812 \ --build-arg BUILDDATE=20260812 \
--build-arg RELEASE=development \ --build-arg RELEASE=development \
--tag ghcr.io/thebinaryninja/tvapp2:development-arm64 \ --tag ghcr.io/thebinaryninja/tvapp2:development-arm64 \
--attest type=provenance,disabled=true \ --attest type=provenance,disabled=true \
--attest type=sbom,disabled=true \ --attest type=sbom,disabled=true \
--output type=docker \
--builder default \
--file Dockerfile \ --file Dockerfile \
--platform linux/arm64 \ --platform linux/arm64 \
--output type=docker \
--allow network.host \ --allow network.host \
--network host \ --network host \
--no-cache \ --no-cache \
@@ -880,8 +888,8 @@ docker buildx build \
After completing the `docker buildx` commands above; you should now have a few new images. Each image should have its own separate docker tags which do not conflict. If you decided to not build the **development** releases below; that is fine. After completing the `docker buildx` commands above; you should now have a few new images. Each image should have its own separate docker tags which do not conflict. If you decided to not build the **development** releases below; that is fine.
- `--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64` - `--tag ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64`
- `--tag ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64` - `--tag ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64`
- `--tag ghcr.io/thebinaryninja/tvapp2:development-amd64` - `--tag ghcr.io/thebinaryninja/tvapp2:development-amd64`
- `--tag ghcr.io/thebinaryninja/tvapp2:development-arm64` - `--tag ghcr.io/thebinaryninja/tvapp2:development-arm64`
@@ -907,15 +915,15 @@ You can also get the hash digests by running the commands:
<br /> <br />
```shell ```shell
$ docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64 $ docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64
Name: ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64 Name: ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64
MediaType: application/vnd.docker.distribution.manifest.v2+json MediaType: application/vnd.docker.distribution.manifest.v2+json
Digest: sha256:0abe1b1c119959b3b1ccc23c56a7ee2c4c908c6aaef290d4ab2993859d807a3b Digest: sha256:0abe1b1c119959b3b1ccc23c56a7ee2c4c908c6aaef290d4ab2993859d807a3b
$ docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64 $ docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64
Name: ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64 Name: ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64
MediaType: application/vnd.docker.distribution.manifest.v2+json MediaType: application/vnd.docker.distribution.manifest.v2+json
Digest: sha256:e68b9de8669eac64d4e4d2a8343c56705e05e9a907cf0b542343f9b536d9c473 Digest: sha256:e68b9de8669eac64d4e4d2a8343c56705e05e9a907cf0b542343f9b536d9c473
``` ```
@@ -962,14 +970,14 @@ Digest: sha256:c719ccb034946e3f0625003f25026d001768794e38a1ba8aafc9146291d548
> ```shell > ```shell
> $ docker images --all --no-trunc | grep thebinaryninja > $ docker images --all --no-trunc | grep thebinaryninja
> >
> ghcr.io/thebinaryninja/tvapp2 1.5.0-arm64 sha256:48520ca15fed6483d2d5b79993126c311f833002345b0e12b8eceb5bf9def966 42 minutes ago 46MB > ghcr.io/thebinaryninja/tvapp2 1.5.2-arm64 sha256:48520ca15fed6483d2d5b79993126c311f833002345b0e12b8eceb5bf9def966 42 minutes ago 46MB
> >
> ghcr.io/thebinaryninja/tvapp2 1.5.0-amd64 sha256:54a9b7d390199532d5667fae67120d77e2f459bd6108b27ce94e0cfec8f3c41f 43 minutes ago 45MB > ghcr.io/thebinaryninja/tvapp2 1.5.2-amd64 sha256:54a9b7d390199532d5667fae67120d77e2f459bd6108b27ce94e0cfec8f3c41f 43 minutes ago 45MB
> ``` > ```
> >
> To get the correct sha256 digest, use: > To get the correct sha256 digest, use:
> - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64` > - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64`
> - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64` > - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64`
> - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:development-amd64` > - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:development-amd64`
> - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:development-arm64` > - `docker buildx imagetools inspect ghcr.io/thebinaryninja/tvapp2:development-arm64`
> >
@@ -989,7 +997,7 @@ For the **stable** releases, use:
# # # #
docker buildx imagetools create \ docker buildx imagetools create \
--tag ghcr.io/thebinaryninja/tvapp2:1.5.0 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5.2 \
--tag ghcr.io/thebinaryninja/tvapp2:1.5 \ --tag ghcr.io/thebinaryninja/tvapp2:1.5 \
--tag ghcr.io/thebinaryninja/tvapp2:1 \ --tag ghcr.io/thebinaryninja/tvapp2:1 \
--tag ghcr.io/thebinaryninja/tvapp2:latest \ --tag ghcr.io/thebinaryninja/tvapp2:latest \
@@ -998,9 +1006,9 @@ docker buildx imagetools create \
[+] Building 0.2s (4/4) FINISHED [+] Building 0.2s (4/4) FINISHED
=> [internal] pushing ghcr.io/thebinaryninja/tvapp2:latest 0.2s => [internal] pushing ghcr.io/thebinaryninja/tvapp2:latest 0.2s
=> [internal] pushing ghcr.io/thebinaryninja/tvapp2:1.5 0.2s
=> [internal] pushing ghcr.io/thebinaryninja/tvapp2:1 0.2s => [internal] pushing ghcr.io/thebinaryninja/tvapp2:1 0.2s
=> [internal] pushing ghcr.io/thebinaryninja/tvapp2:1.5.0 0.2s => [internal] pushing ghcr.io/thebinaryninja/tvapp2:1.5 0.2s
=> [internal] pushing ghcr.io/thebinaryninja/tvapp2:1.5.2 0.2s
``` ```
<br /> <br />
@@ -1046,8 +1054,8 @@ In this example, we take the existing two files we created earlier, and merge th
```shell ```shell
# Example 1 (using tag) # Example 1 (using tag)
docker manifest create ghcr.io/thebinaryninja/tvapp2:latest \ docker manifest create ghcr.io/thebinaryninja/tvapp2:latest \
--amend ghcr.io/thebinaryninja/tvapp2:1.5.0-amd64 \ --amend ghcr.io/thebinaryninja/tvapp2:1.5.2-amd64 \
--amend ghcr.io/thebinaryninja/tvapp2:1.5.0-arm64 --amend ghcr.io/thebinaryninja/tvapp2:1.5.2-arm64
# Example 2 (using sha256 hash) # Example 2 (using sha256 hash)
docker manifest create ghcr.io/thebinaryninja/tvapp2:latest \ docker manifest create ghcr.io/thebinaryninja/tvapp2:latest \
@@ -1088,7 +1096,7 @@ To build the project, `🗔 cd` into the project folder and run the build comman
```shell ```shell
cd /home/docker/tvapp2/ cd /home/docker/tvapp2/
npm run docker:build:amd64 --VERSION=1.5.0 --BUILDDATE=20260812 npm run docker:build:amd64 --VERSION=1.5.2 --BUILDDATE=20260812
``` ```
<br /> <br />

View File

@@ -1,148 +1,14 @@
#!/usr/bin/with-contenv sh #!/usr/bin/with-contenv sh
# #
# defaults
# #
DIR_BUILD=${DIR_BUILD:-/usr/src/app}
DIR_RUN=${DIR_RUN:-/usr/bin/app}
bHasError=false
# #
# define > colors
#
# Use the color table at:
# - https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
# #
declare -A c=(
[end]=$'\e[0m'
[white]=$'\e[97m'
[bold]=$'\e[1m'
[dim]=$'\e[2m'
[underline]=$'\e[4m'
[strike]=$'\e[9m'
[blink]=$'\e[5m'
[inverted]=$'\e[7m'
[hidden]=$'\e[8m'
[black]=$'\e[0;30m'
[redl]=$'\e[0;91m'
[redd]=$'\e[0;31m'
[magental]=$'\e[0;95m'
[magentad]=$'\e[0;35mm'
[bluel]=$'\e[0;94m'
[blued]=$'\e[0;34m'
[cyanl]=$'\e[0;96m'
[cyand]=$'\e[0;36m'
[greenl]=$'\e[0;92m'
[greend]=$'\e[0;32m'
[yellowl]=$'\e[0;93m'
[yellowd]=$'\e[0;33m'
[greyl]=$'\e[0;37m'
[greyd]=$'\e[0;90m'
[navy]=$'\e[38;5;62m'
[olive]=$'\e[38;5;144m'
[peach]=$'\e[38;5;210m'
)
# #
# unicode for emojis
# https://apps.timwhitlock.info/emoji/tables/unicode
# #
declare -A icon=(
["symbolic link"]=$'\xF0\x9F\x94\x97' # 🔗
["regular file"]=$'\xF0\x9F\x93\x84' # 📄
["directory"]=$'\xF0\x9F\x93\x81' # 📁
["regular empty file"]=$'\xe2\xad\x95' # ⭕
["log"]=$'\xF0\x9F\x93\x9C' # 📜
["1"]=$'\xF0\x9F\x93\x9C' # 📜
["2"]=$'\xF0\x9F\x93\x9C' # 📜
["3"]=$'\xF0\x9F\x93\x9C' # 📜
["4"]=$'\xF0\x9F\x93\x9C' # 📜
["5"]=$'\xF0\x9F\x93\x9C' # 📜
["pem"]=$'\xF0\x9F\x94\x92' # 🔑
["pub"]=$'\xF0\x9F\x94\x91' # 🔒
["pfx"]=$'\xF0\x9F\x94\x92' # 🔑
["p12"]=$'\xF0\x9F\x94\x92' # 🔑
["key"]=$'\xF0\x9F\x94\x91' # 🔒
["crt"]=$'\xF0\x9F\xAA\xAA ' # 🪪
["gz"]=$'\xF0\x9F\x93\xA6' # 📦
["zip"]=$'\xF0\x9F\x93\xA6' # 📦
["gzip"]=$'\xF0\x9F\x93\xA6' # 📦
["deb"]=$'\xF0\x9F\x93\xA6' # 📦
["sh"]=$'\xF0\x9F\x97\x94' # 🗔
)
# #
# define > system
# #
sys_os_ver="1.0.0"
sys_os_name="Unknown"
sys_arch=$(dpkg --print-architecture)
sys_code=$(lsb_release -cs)
# #
# define > distro
# freedesktop.org and systemd
# returns distro information.
# #
if [ -f /etc/os-release ]; then
. /etc/os-release
sys_os_name=$NAME
sys_os_ver=$VERSION_ID
# #
# distro > linuxbase.org
# #
elif type lsb_release >/dev/null 2>&1; then
sys_os_name=$(lsb_release -si)
sys_os_ver=$(lsb_release -sr)
# #
# distro > versions of Debian/Ubuntu without lsb_release cmd
# #
elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release
sys_os_name=$DISTRIB_ID
sys_os_ver=$DISTRIB_RELEASE
# #
# distro > older Debian/Ubuntu/etc distros
# #
elif [ -f /etc/debian_version ]; then
sys_os_name=Debian
sys_os_ver=$(cat /etc/debian_version)
# #
# distro > fallback: uname, e.g. "Linux <version>", also works for BSD
# #
else
sys_os_name=$(uname -s)
sys_os_ver=$(uname -r)
fi
# # # #
# Store env variables in s6 # Store env variables in s6
# # # #
printf '%-29s %-65s\n' " ${c[blued]}STATUS${c[end]}" "${c[end]}Fetching docker container and gateway addresses${c[end]}"
ip_gateway=$(/sbin/ip route|awk '/default/ { print $3 }') ip_gateway=$(/sbin/ip route|awk '/default/ { print $3 }')
ip_container=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') ip_container=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
if [ -d "/var/run/s6/container_environment/" ]; then printf "$ip_gateway" > /var/run/s6/container_environment/IP_GATEWAY
printf "$ip_gateway" > /var/run/s6/container_environment/IP_GATEWAY printf "$ip_container" > /var/run/s6/container_environment/IP_CONTAINER
printf "$ip_container" > /var/run/s6/container_environment/IP_CONTAINER
else
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot generate s6-overlay env files; folder ${c[redl]}/var/run/s6/container_environment/${c[end]} does not exist${c[end]}"
bHasError=true
fi
export IP_GATEWAY=$ip_gateway export IP_GATEWAY=$ip_gateway
export IP_GATEWAY=$ip_container export IP_GATEWAY=$ip_container
@@ -151,78 +17,8 @@ export IP_GATEWAY=$ip_container
# install and startup for tvapp2 # install and startup for tvapp2
# # # #
printf '%-29s %-65s\n' " ${c[blued]}STATUS${c[end]}" "${c[end]}Copying ${c[blued]}${DIR_BUILD}${c[end]} to ${c[blued]}${DIR_RUN}${c[end]}" cp -r ${DIR_BUILD}/* ${DIR_RUN}
if [ -z "${DIR_BUILD}" ]; then rm -rf ${DIR_BUILD}/*
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot copy; env var ${c[redl]}\${DIR_BUILD}${c[end]} missing${c[end]}" cd ${DIR_RUN}
bHasError=true npm install --omit=dev
else npm start
if [ -d "${DIR_BUILD}" ]; then
echo OK
cp -r ${DIR_BUILD}/* ${DIR_RUN}
else
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot copy folder ${c[redl]}${DIR_BUILD}${c[end]} to ${c[redl]}${DIR_RUN}${c[end]}; build folder ${c[redl]}${DIR_BUILD}${c[end]} does not exist${c[end]}"
bHasError=true
fi
fi
# #
# remove build directory
# #
printf '%-29s %-65s\n' " ${c[blued]}STATUS${c[end]}" "${c[end]}Remove ${c[blued]}${DIR_BUILD}/${c[end]}"
if [ -z "${DIR_BUILD}" ]; then
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot remove; env var ${c[redl]}\${DIR_BUILD}${c[end]} missing${c[end]}"
else
if [ -d "${DIR_BUILD}" ]; then
echo OK
rm -rf ${DIR_BUILD}/*
else
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot remove; build folder ${c[redl]}${DIR_BUILD}${c[end]} does not exist${c[end]}"
fi
fi
# #
# cd to BUILD_RUN directory
# #
printf '%-29s %-65s\n' " ${c[blued]}STATUS${c[end]}" "${c[end]}Changing to run directory ${c[blued]}${DIR_RUN}/${c[end]}"
if [ -z "${DIR_RUN}" ]; then
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot cd; env var ${c[redl]}\${DIR_RUN}${c[end]} missing${c[end]}"
bHasError=true
else
if [ -d "${DIR_RUN}" ]; then
echo OK
cd ${DIR_RUN}
else
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot cd; run folder ${c[redl]}${DIR_RUN}${c[end]} does not exist${c[end]}"
bHasError=true
fi
fi
# #
# install tvapp2 via npm
# #
printf '%-29s %-65s\n' " ${c[blued]}STATUS${c[end]}" "${c[end]}Running command ${c[blued]}npm install --omit=dev${c[end]}"
if ! [ -x "$(command -v npm)" ]; then
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Cannot install TVApp2 with npm because package ${c[redl]}npm${c[end]} not installed${c[end]}"
bHasError=true
else
npm install --omit=dev
printf '%-29s %-65s\n' " ${c[blued]}STATUS${c[end]}" "${c[end]}Running command ${c[blued]}npm start${c[end]}"
npm start
fi
# #
# finished run script
# #
printf '%-29s %-65s\n' " ${c[greenl]}OK${c[end]}" "${c[end]}Finished initializing script${c[end]}"
if [ "$bHasError" = true ] ; then
printf '%-29s %-65s\n' "" ""
printf '%-29s %-65s\n' " ${c[redl]}ERROR${c[end]}" "${c[end]}Fatal errors were detected${c[end]}"
printf '%-29s %-65s\n' " ${c[redl]}${c[end]}" "${c[end]}The run script detected that certain steps failed. This app may not${c[end]}"
printf '%-29s %-65s\n' " ${c[redl]}${c[end]}" "${c[end]}work properly. Try restarting the container.${c[end]}"
printf '%-29s %-65s\n' "" ""
fi