Update build.func
Code refactoring
This commit is contained in:
parent
6501d0f43f
commit
231f02ca01
1 changed files with 8 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
variables() {
|
variables() {
|
||||||
NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
|
NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
|
||||||
var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP.
|
var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP.
|
||||||
INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern.
|
INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern.
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function sets various color variables using ANSI escape codes for formatting text in the terminal.
|
# This function sets various color variables using ANSI escape codes for formatting text in the terminal.
|
||||||
|
@ -517,8 +517,8 @@ build_container() {
|
||||||
|
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
if [ "$CT_TYPE" == "0" ]; then
|
if [ "$CT_TYPE" == "0" ]; then
|
||||||
if [[ "$APP" != "Emby" && "$APP" != "Jellyfin" && "$APP" != "Plex" && "$APP" != "Tdarr" ]]; then
|
cat <<EOF >>$LXC_CONFIG
|
||||||
cat <<EOF >>$LXC_CONFIG
|
# USB passthrough
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
@ -529,14 +529,12 @@ lxc.mount.entry: /dev/ttyUSB1 dev/ttyUSB1 none bind,optional,create=
|
||||||
lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file
|
lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file
|
||||||
lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file
|
lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file
|
||||||
EOF
|
EOF
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CT_TYPE" == "0" ]; then
|
if [ "$CT_TYPE" == "0" ]; then
|
||||||
if [[ "$APP" == "Emby" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Tdarr" ]]; then
|
if [[ "$APP" == "Emby" || "$APP" == "Jellyfin" || "$APP" == "Plex" || "$APP" == "Scrypted" || "$APP" == "Tdarr" ]]; then
|
||||||
cat <<EOF >>$LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
# VAAPI hardware transcoding
|
||||||
lxc.cap.drop:
|
|
||||||
lxc.cgroup2.devices.allow: c 226:0 rwm
|
lxc.cgroup2.devices.allow: c 226:0 rwm
|
||||||
lxc.cgroup2.devices.allow: c 226:128 rwm
|
lxc.cgroup2.devices.allow: c 226:128 rwm
|
||||||
lxc.cgroup2.devices.allow: c 29:0 rwm
|
lxc.cgroup2.devices.allow: c 29:0 rwm
|
||||||
|
@ -547,7 +545,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This starts the container and executes <app>-install.sh
|
# This starts the container and executes <app>-install.sh
|
||||||
msg_info "Starting LXC Container"
|
msg_info "Starting LXC Container"
|
||||||
pct start "$CTID"
|
pct start "$CTID"
|
||||||
msg_ok "Started LXC Container"
|
msg_ok "Started LXC Container"
|
||||||
|
|
Loading…
Reference in a new issue