Skip to content

Commit

Permalink
The major install shakeup
Browse files Browse the repository at this point in the history
  • Loading branch information
erichlf committed May 3, 2024
1 parent cff3725 commit 8297976
Show file tree
Hide file tree
Showing 11 changed files with 744 additions and 424 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ self-explanatory.

## Install

To install everythings, which is quite a bit and almost certainly
not what you really want to do, just run `./install.sh`. This will bring up a
UI that allows you to select the features you want to install. There is a menu
item for installing the dotfiles only. If you are reading this it is most
likely what you would want.
I have a single `install.sh` that determines the current system and then calls
the appropriate install script (defined in `scripts`) from there. For
consistency any manually installed items and functions are defined in
`scripts/utils.sh`. The install process is as simple as running `./install.sh`,
while located in the `DOTFILES_DIR`. Some of the functions in `scrips/utils.sh`
do expect both `SYSTEM` and `DOTFILES` to be defined. `SYSTEM` is simply the
the name given to your current system. It can be anything you like and is mostly
there for debugging.

If all you are interested in is installing the dotfiles I would recommend running
`./scripts/main.sh` and selecting the menu item corresponding to "Create symbolic
links".
38 changes: 38 additions & 0 deletions docker/tvnamer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM debian:sid-slim

ENV LC_ALL=C.UTF-8 \
LANG=C.UTF-8 \
LANGUAGE=en_US:en

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN set -x && \
KEPT_PACKAGES=() && \
# Packages kept in the image
KEPT_PACKAGES+=(bash) && \
KEPT_PACKAGES+=(ca-certificates) && \
KEPT_PACKAGES+=(locales) && \
KEPT_PACKAGES+=(locales-all) && \
KEPT_PACKAGES+=(python3) && \
KEPT_PACKAGES+=(python-is-python3) && \
KEPT_PACKAGES+=(python3-pip) && \
KEPT_PACKAGES+=(python3-pyxattr) && \
KEPT_PACKAGES+=(adduser) && \
# Install packages
apt-get update -y && \
apt-get install -y --no-install-recommends \
${KEPT_PACKAGES[@]} \
&& \
# Create /config directory
mkdir -p /config && \
# Clean-up
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* /tmp/*
RUN rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED && \
pip3 install --no-cache tvnamer

# # Copy init script, set workdir, set configdir & entrypoint
COPY init /init
WORKDIR /workdir
ENTRYPOINT ["/init"]
37 changes: 37 additions & 0 deletions docker/tvnamer/init
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Create dockeruser homedir
mkdir -p /home/dockeruser

# Set UID/PID of user that youtube-dl will be run as
TVNAMERPGID=${PGID:-1000}
TVNAMERPUID=${PUID:-1000}

# Check to see if group/user already exist, if so, delete
EXISTINGGROUPNAME=$(getent group "$TVNAMERPGID" | cut -d ':' -f 1)
EXISTINGUSERNAME=$(getent passwd "$TVNAMERPUID" | cut -d ':' -f 1)
if [[ -n "$EXISTINGGROUPNAME" ]]; then
groupdel -f "$EXISTINGGROUPNAME"
fi
if [[ -n "$EXISTINGUSERNAME" ]]; then
userdel -f "$EXISTINGUSERNAME"
fi

# Create user/group
addgroup --quiet --gid "$TVNAMERPGID" dockeruser
chown -R "$TVNAMERPUID":"$TVNAMERPGID" /home/dockeruser
adduser --quiet --system --disabled-password --uid "$TVNAMERPUID" --gid "$TVNAMERPGID" --home /home/dockeruser dockeruser
HOME=/home/dockeruser
export HOME

# Set UMASK if required
if [[ -n "$UMASK" ]]; then
umask "$UMASK"
fi

# Run tvnamer with remainder of command line arguments
if [ -f /config/tvnamerconfig.json ]; then
setpriv --reuid dockeruser --regid dockeruser --keep-groups tvnamer -c /config/tvnamerconfig.json "$@"
else
setpriv --reuid dockeruser --regid dockeruser --keep-groups tvnamer "$@"
fi
Loading

0 comments on commit 8297976

Please sign in to comment.