Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Sam Heinz
2024-05-09 16:50:55 +10:00
13 changed files with 252 additions and 299 deletions
-2
View File
@@ -43,8 +43,6 @@ if [[ "$CTTYPE" == "0" ]]; then
chgrp video /dev/dri
chmod 755 /dev/dri
chmod 660 /dev/dri/*
$STD adduser $(id -u -n) video
$STD adduser $(id -u -n) render
fi
msg_ok "Set Up Hardware Acceleration"
+3 -56
View File
@@ -14,68 +14,15 @@ network_check
update_os
msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \
git \
curl \
sudo \
mc \
bluez \
libffi-dev \
libssl-dev \
libjpeg-dev \
zlib1g-dev \
autoconf \
build-essential \
libopenjp2-7 \
libturbojpeg0-dev \
ffmpeg \
liblapack3 \
liblapack-dev \
dbus-broker \
libpcap-dev \
libavdevice-dev \
libavformat-dev \
libavcodec-dev \
libavutil-dev \
libavfilter-dev \
libmariadb-dev-compat \
libatlas-base-dev \
wget
$STD apt-get install -y {git,curl,sudo,mc,bluez,libffi-dev,libssl-dev,libjpeg-dev,zlib1g-dev,autoconf,build-essential,libopenjp2-7,libturbojpeg0-dev,ffmpeg,liblapack3,liblapack-dev,dbus-broker,libpcap-dev,libavdevice-dev,libavformat-dev,libavcodec-dev,libavutil-dev,libavfilter-dev,libmariadb-dev-compat,libatlas-base-dev,python3-pip,python3.12-venv,wget}
msg_ok "Installed Dependencies"
#RELEASE=$(curl -s https://www.python.org/downloads/ | grep -oP 'Download Python \K\d+\.\d+\.\d+' | head -1)
msg_info "Compiling Python 3.12 from its source (Additional Patience)"
$STD apt-get remove -y python3
$STD apt-get install -y \
checkinstall \
libreadline-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
tk-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev
#wget -qO- https://www.python.org/ftp/python/${RELEASE}/Python-${RELEASE}.tar.xz | tar -xJ
wget -qO- https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz | tar -xJ
cd Python-3.12.2
$STD ./configure --enable-optimizations
$STD make -j $(nproc)
$STD make altinstall
$STD update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.12 1
cd ~
rm -rf Python-3.12.2
msg_ok "Installed Python 3.12"
rm -rf /usr/local/bin/python3.*/EXTERNALLY-MANAGED
msg_info "Installing Home Assistant-Core"
mkdir /srv/homeassistant
cd /srv/homeassistant
python3 -m venv .
source bin/activate
$STD pip install --upgrade pip
$STD pip install webrtcvad
$STD python3 -m pip install wheel
$STD pip install homeassistant
$STD pip install mysqlclient
@@ -97,7 +44,7 @@ RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
EOF
$STD systemctl enable --now homeassistant
systemctl enable -q --now homeassistant
msg_ok "Created Service"
motd_ssh
+14 -11
View File
@@ -13,15 +13,6 @@ setting_up_container
network_check
update_os
msg_info "Installing Python3"
$STD apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-dev \
python3-setuptools \
python3-wheel
msg_ok "Installed Python3"
msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y --no-install-recommends \
redis \
@@ -50,6 +41,15 @@ $STD apt-get install -y --no-install-recommends \
wget
msg_ok "Installed Dependencies"
msg_info "Installing Python3 Dependencies"
$STD apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-dev \
python3-setuptools \
python3-wheel
msg_ok "Installed Python3 Dependencies"
msg_info "Installing OCR Dependencies (Patience)"
$STD apt-get install -y --no-install-recommends \
unpaper \
@@ -92,6 +92,7 @@ sed -i -e "s|#PAPERLESS_CONSUMPTION_DIR=../consume|PAPERLESS_CONSUMPTION_DIR=/op
sed -i -e "s|#PAPERLESS_DATA_DIR=../data|PAPERLESS_DATA_DIR=/opt/paperless/data|" /opt/paperless/paperless.conf
sed -i -e "s|#PAPERLESS_MEDIA_ROOT=../media|PAPERLESS_MEDIA_ROOT=/opt/paperless/media|" /opt/paperless/paperless.conf
sed -i -e "s|#PAPERLESS_STATICDIR=../static|PAPERLESS_STATICDIR=/opt/paperless/static|" /opt/paperless/paperless.conf
echo "${Paperlessngx}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Paperless-ngx"
msg_info "Installing Natural Language Toolkit (Patience)"
@@ -99,13 +100,15 @@ $STD python3 -m nltk.downloader -d /usr/share/nltk_data all
msg_ok "Installed Natural Language Toolkit"
msg_info "Setting up PostgreSQL database"
export LC_ALL=C.UTF-8
DB_NAME=paperlessdb
DB_USER=paperless
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
SECRET_KEY="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
echo "" >>~/paperless.creds
echo -e "Paperless-ngx Database User: \e[32m$DB_USER\e[0m" >>~/paperless.creds
echo -e "Paperless-ngx Database Password: \e[32m$DB_PASS\e[0m" >>~/paperless.creds
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
msg_ok "Installed Dependencies"
msg_info "Installing Pocketbase"
RELEASE=$(curl -s https://api.github.com/repos/pocketbase/pocketbase/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q https://github.com/pocketbase/pocketbase/releases/download/v${RELEASE}/pocketbase_${RELEASE}_linux_amd64.zip -O /tmp/pocketbase.zip
mkdir -p /opt/pocketbase/{pb_public,pb_migrations,pb_hooks}
unzip -q -o /tmp/pocketbase.zip -d /opt/pocketbase
cat <<EOF >/etc/systemd/system/pocketbase.service
[Unit]
Description = pocketbase
[Service]
Type = simple
LimitNOFILE = 4096
Restart = always
RestartSec = 5s
StandardOutput = append:/opt/pocketbase/errors.log
StandardError = append:/opt/pocketbase/errors.log
ExecStart = /opt/pocketbase/pocketbase serve --http=0.0.0.0:8080
[Install]
WantedBy = multi-user.target
EOF
systemctl enable -q --now pocketbase.service
msg_ok "Installed Pocketbase"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"