ehbrs_ruby_utils 0.50.2 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 313577609ee6eb941fe4555a69dd45857adabbe01969cabf59c3fae4021aa07c
4
- data.tar.gz: d23750e408c10e7724fb7292504a601ff6d8118823f881ff6f41f9febaca4fee
3
+ metadata.gz: 59fd088c78768f47d8c0d60dd1a323ee1aff664fddc42da69ae116c0987a5bef
4
+ data.tar.gz: 21b1c837106b2db71f5840adad05dbd4f37ed262cb5b6b98b1ad4569c04d5474
5
5
  SHA512:
6
- metadata.gz: 11dadee80b32212622c880e31c379cae640df69cb101b77d51fe5de0e89753ce879705615f2bc1c4e0eda9a4c7e0b3bd9e6ef68482817642d41a77c6bad06256
7
- data.tar.gz: 7e1628e39e81cfc507bf1151cd7ae89e9c5a28ecf4a7187971cc1a7f00eed40cc153ce22abb5dc25153d52ecb07eda21eef1150b5c72cd73de528efec48c5ca5
6
+ metadata.gz: c65b15d5e7a402059e623fb7a66e02bd03a35baaed05253adfac8878bcea3bc5bd89e3503058385682e9966195c0218231f4ef3018f5254fb28740023de43ba6
7
+ data.tar.gz: 28138be728e5eb054bb3105088432e94161a2425a014ff8427234a5415ef2ab8b9792ec92285835538534d0f229fe46b55ab1dd0884656735e08907d519d6430
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.50.2'
4
+ VERSION = '0.51.0'
5
5
  end
@@ -1,44 +1,55 @@
1
- FROM ubuntu:18.04
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
4
- ENV USER_UID=1000
5
- ENV USER_GID=1000
6
- ENV USERNAME=user
7
-
8
- # sudo gosu \
9
-
10
- RUN ln -sf /bin/true /usr/bin/chfn && apt-get update && apt-get install -y \
11
- libnss3-tools \
12
- zenity \
13
- libgtk2.0-0 \
1
+ FROM debian:trixie-slim
2
+
3
+ ARG DEBIAN_MIRROR=http://ftp.br.debian.org
4
+ ARG WARSAW_URL=https://guardiao.itau.com.br/warsaw/warsaw_ubuntu.run
5
+ ARG WARSAW_SHA256=7b7e27961ccfb5ed9fb9d5eef00a44db81a6a0e778f96886464ffcacc28b9144
6
+
7
+ ENV DEBIAN_FRONTEND=noninteractive \
8
+ LANG=C.UTF-8 \
9
+ RESOLUTION=1366x768 \
10
+ START_URL=https://www.bb.com.br \
11
+ USER_GID=1000 \
12
+ USER_UID=1000
13
+
14
+ RUN sed -i "s#http://deb.debian.org#$DEBIAN_MIRROR#" /etc/apt/sources.list.d/debian.sources \
15
+ && apt-get update \
16
+ && apt-get install -y --no-install-recommends \
17
+ ca-certificates \
18
+ curl \
14
19
  dbus-x11 \
15
- yad \
16
- libcurl3 \
17
- libdbus-1.3 \
18
- libxss1 \
19
- lsb-release \
20
- net-tools \
21
- openssl \
22
- firefox \
23
- systemd \
24
- systemd-sysv
25
-
26
-
27
- ADD https://cloud.gastecnologia.com.br/cef/warsaw/install/GBPCEFwr64.deb /src/warsaw.deb
28
- RUN groupadd -g ${USER_GID} user && useradd -u ${USER_UID} -g ${USER_GID} -ms /bin/bash user && chown -R user.user /home/user
29
-
30
- #RUN dpkg -i /w.deb || exit 0
31
-
32
- COPY context/firefox.service /etc/systemd/system/
33
- COPY context/startbrowser.sh /usr/local/bin/
20
+ firefox-esr \
21
+ firefox-esr-l10n-pt-br \
22
+ fonts-dejavu \
23
+ fonts-liberation \
24
+ libarchive-tools \
25
+ libdbus-1-3 \
26
+ novnc \
27
+ openbox \
28
+ procps \
29
+ python3 \
30
+ tigervnc-standalone-server \
31
+ tigervnc-tools \
32
+ websockify \
33
+ zenity \
34
+ && rm -rf /var/lib/apt/lists/*
34
35
 
35
- # systemctl enable warsaw && \
36
+ RUN curl -fsSLo /tmp/warsaw.run "$WARSAW_URL" \
37
+ && echo "$WARSAW_SHA256 /tmp/warsaw.run" | sha256sum -c - \
38
+ && bsdtar -xf /tmp/warsaw.run -C /tmp --strip-components 1 'warsaw_setup/warsaw_*_amd64.deb' \
39
+ && printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d \
40
+ && chmod +x /usr/sbin/policy-rc.d \
41
+ && touch /tmp/EULA \
42
+ && apt-get update \
43
+ && apt-get install -y --no-install-recommends /tmp/warsaw_*_amd64.deb \
44
+ && { pkill -f -x /usr/local/bin/warsaw/core || :; } \
45
+ && rm -rf /tmp/warsaw* /usr/sbin/policy-rc.d /var/lib/apt/lists/*
36
46
 
37
- RUN mkdir -p /var/run/dbus && \
38
- systemctl enable firefox && \
39
- systemctl disable systemd-resolved && systemctl disable systemd-tmpfiles-setup.service
47
+ COPY policies.json /usr/lib/firefox-esr/distribution/policies.json
48
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
40
49
 
41
- STOPSIGNAL SIGRTMIN+3
50
+ RUN useradd --create-home --shell /bin/bash browser \
51
+ && install -d -m 1777 /tmp/.X11-unix
42
52
 
53
+ EXPOSE 6080
43
54
 
44
- ENTRYPOINT [ "/sbin/init" ]
55
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
@@ -0,0 +1,87 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ export DISPLAY=:1
5
+
6
+ readonly BROWSER_USER='browser'
7
+ readonly BROWSER_HOME="/home/$BROWSER_USER"
8
+ readonly NOVNC_PORT=6080
9
+ readonly PROFILE_DIR="$BROWSER_HOME/.mozilla/firefox/bb"
10
+ readonly VNC_PASSWORD_FILE="$BROWSER_HOME/.vnc/passwd"
11
+ readonly VNC_PORT=5900
12
+ readonly WARSAW_CORE='/usr/local/bin/warsaw/core'
13
+
14
+ apply_host_ids() {
15
+ groupmod -g "$USER_GID" "$BROWSER_USER"
16
+ usermod -u "$USER_UID" -g "$USER_GID" "$BROWSER_USER"
17
+ }
18
+
19
+ as_user() {
20
+ runuser -u "$BROWSER_USER" -- env HOME="$BROWSER_HOME" DISPLAY="$DISPLAY" LANG="$LANG" \
21
+ XDG_RUNTIME_DIR="$(runtime_dir)" "$@"
22
+ }
23
+
24
+ create_runtime_dir() {
25
+ install -d -o "$BROWSER_USER" -g "$BROWSER_USER" -m 700 "$(runtime_dir)"
26
+ }
27
+
28
+ main() {
29
+ remove_stale_locks
30
+ apply_host_ids
31
+ create_runtime_dir
32
+ write_vnc_password
33
+ start_vnc
34
+ as_user openbox &
35
+ as_user mkdir -p "$PROFILE_DIR"
36
+ start_warsaw
37
+ start_novnc
38
+ run_browser
39
+ }
40
+
41
+ remove_stale_locks() {
42
+ rm -f "/tmp/.X${DISPLAY#:}-lock" "/tmp/.X11-unix/X${DISPLAY#:}" "$PROFILE_DIR/lock" \
43
+ "$PROFILE_DIR/.parentlock"
44
+ }
45
+
46
+ run_browser() {
47
+ as_user firefox-esr --profile "$PROFILE_DIR" "$START_URL"
48
+ }
49
+
50
+ runtime_dir() {
51
+ echo "/run/user/$(id -u "$BROWSER_USER")"
52
+ }
53
+
54
+ start_novnc() {
55
+ websockify --web /usr/share/novnc "$NOVNC_PORT" "localhost:$VNC_PORT" > /dev/null 2>&1 &
56
+ }
57
+
58
+ start_vnc() {
59
+ as_user Xvnc "$DISPLAY" -geometry "$RESOLUTION" -depth 24 -rfbport "$VNC_PORT" -localhost \
60
+ -SecurityTypes VncAuth -PasswordFile "$VNC_PASSWORD_FILE" -AlwaysShared &
61
+ wait_for_display
62
+ }
63
+
64
+ start_warsaw() {
65
+ "$WARSAW_CORE"
66
+ as_user "$WARSAW_CORE"
67
+ }
68
+
69
+ wait_for_display() {
70
+ local attempt
71
+ for attempt in $(seq 50); do
72
+ [ -S "/tmp/.X11-unix/X${DISPLAY#:}" ] && return 0
73
+ sleep 0.2
74
+ done
75
+ echo 'X server did not start' >&2
76
+ return 1
77
+ }
78
+
79
+ write_vnc_password() {
80
+ : "${VNC_PASSWORD:?VNC_PASSWORD must be set}"
81
+ install -d -o "$BROWSER_USER" -g "$BROWSER_USER" -m 700 "$(dirname "$VNC_PASSWORD_FILE")"
82
+ printf '%s\n' "$VNC_PASSWORD" | vncpasswd -f > "$VNC_PASSWORD_FILE"
83
+ chown "$BROWSER_USER:$BROWSER_USER" "$VNC_PASSWORD_FILE"
84
+ chmod 600 "$VNC_PASSWORD_FILE"
85
+ }
86
+
87
+ main
@@ -0,0 +1,18 @@
1
+ {
2
+ "policies": {
3
+ "DisableAppUpdate": true,
4
+ "DisableFirefoxStudies": true,
5
+ "DisableTelemetry": true,
6
+ "DontCheckDefaultBrowser": true,
7
+ "DownloadDirectory": "/downloads",
8
+ "OverrideFirstRunPage": "",
9
+ "OverridePostUpdatePage": "",
10
+ "Preferences": {
11
+ "browser.translations.enable": {
12
+ "Value": false,
13
+ "Status": "locked"
14
+ }
15
+ },
16
+ "RequestedLocales": ["pt-BR"]
17
+ }
18
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehbrs_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.2
4
+ version: 0.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
@@ -154,7 +154,7 @@ dependencies:
154
154
  version: '0.1'
155
155
  - - ">="
156
156
  - !ruby/object:Gem::Version
157
- version: 0.1.1
157
+ version: 0.1.2
158
158
  type: :runtime
159
159
  prerelease: false
160
160
  version_requirements: !ruby/object:Gem::Requirement
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: '0.1'
165
165
  - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 0.1.1
167
+ version: 0.1.2
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: eac_templates
170
170
  requirement: !ruby/object:Gem::Requirement
@@ -429,12 +429,9 @@ files:
429
429
  - lib/ehbrs_ruby_utils/web_utils/videos/file.rb
430
430
  - lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb
431
431
  - lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb
432
- - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/.gitrepo
433
432
  - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Dockerfile
434
- - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/Makefile
435
- - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/README.md
436
- - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/firefox.service
437
- - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/context/startbrowser.sh
433
+ - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/entrypoint.sh
434
+ - template/ehbrs_ruby_utils/finances/bb_browser/docker_image/policies.json
438
435
  - template/ehbrs_ruby_utils/music/lyrics_book/album/inner.html.erb
439
436
  - template/ehbrs_ruby_utils/music/lyrics_book/custom_style.css
440
437
  - template/ehbrs_ruby_utils/music/lyrics_book/index.html.erb
@@ -1,12 +0,0 @@
1
- ; DO NOT EDIT (unless you know what you are doing)
2
- ;
3
- ; This subdirectory is a git "subrepo", and this file is maintained by the
4
- ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
5
- ;
6
- [subrepo]
7
- remote = https://github.com/jsalatiel/wsbb-podman.git
8
- branch = master
9
- commit = 17e9e19bd755c3312b4cb7dd427acdf110b8a5f0
10
- parent = f94d3b2833c4f75b55dd64d21d3440a3ab96a106
11
- method = merge
12
- cmdver = 0.4.1
@@ -1,35 +0,0 @@
1
- IMG=jsalatiel/wsbb-podman:latest
2
- CONTAINER_NAME=wsbb
3
- DOCKERCMD=sudo podman
4
-
5
-
6
- USER_UID = $(shell id -u $(USER))
7
- USER_GID = $(shell id -g $(USER))
8
- ifeq ($(shell uname),Darwin)
9
- USER_GID = $(shell id -u $(USER))
10
- endif
11
-
12
- build:
13
- $(DOCKERCMD) build -t ${IMG} .
14
-
15
- start:
16
- $(DOCKERCMD) run -d --rm -it --name ${CONTAINER_NAME} \
17
- --cap-add CAP_AUDIT_WRITE --cap-add CAP_SYS_PTRACE \
18
- -e USER_UID=$(USER_UID) \
19
- -e USER_GID=$(USER_GID) \
20
- -v "$(HOME)/.Xauthority:/home/user/.Xauthority:ro" \
21
- -v "/tmp/.X11-unix:/tmp/.X11-unix:ro" \
22
- -v "/etc/machine-id:/etc/machine-id:ro" \
23
- $(IMG) seg.bb.com.br
24
- logs:
25
- $(DOCKERCMD) logs -f ${CONTAINER_NAME}
26
-
27
- shell:
28
- $(DOCKERCMD) exec -it ${CONTAINER_NAME} bash
29
-
30
- stop:
31
- -$(DOCKERCMD) kill ${CONTAINER_NAME}
32
-
33
- remove:
34
- -$(DOCKERCMD) image rm ${CONTAINER_NAME}
35
-
@@ -1,16 +0,0 @@
1
- # wsbb-podman
2
- Credits go to farribeiro/wscef-docker and juliohm1978/dockerbb
3
-
4
-
5
- **make build** to build the container
6
-
7
- **make start** to run the container ( It may take a while to start firefox - Just wait)
8
-
9
- When you close firefox the container will be deleted.
10
-
11
-
12
-
13
-
14
-
15
-
16
-
@@ -1,8 +0,0 @@
1
- [Unit]
2
-
3
- [Service]
4
- ExecStart=/usr/local/bin/startbrowser.sh
5
- Restart=no
6
-
7
- [Install]
8
- WantedBy=multi-user.target
@@ -1,9 +0,0 @@
1
- #!/bin/bash -xe
2
-
3
- /usr/bin/dpkg -D10 -i /src/warsaw.deb
4
- systemctl enable --now warsaw
5
-
6
- runuser -l user -c "XAUTHORITY=/home/user/.Xauthority DISPLAY=:0 firefox --no-remote --new-instance https://seg.bb.com.br"
7
-
8
- kill -SIGRTMIN+3 1
9
-