Skip to content

Commit

Permalink
install config files to /etc/arm/config
Browse files Browse the repository at this point in the history
  • Loading branch information
shitwolfymakes authored and wolfy committed Mar 28, 2022
1 parent 1a0fb19 commit b31572b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 42 deletions.
36 changes: 16 additions & 20 deletions scripts/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,31 @@ if ! id -u "${USER}" ; then
useradd --shell /bin/bash \
-u "${UID}" -g "${GID}" -G video,cdrom \
-o -c "" "${USER}"
chown "${USER}.${USER}" "${HOME}"
chown -R "${USER}:${USER}" "${HOME}"
fi

# setup needed/expected dirs if not found
SUBDIRS="config media media/completed media/raw media/movies logs db Music .MakeMKV"
SUBDIRS="media media/completed media/raw media/movies logs db Music .MakeMKV"
for dir in $SUBDIRS ; do
thisDir="${HOME}/${dir}"
if [[ ! -d "${thisDir}" ]] ; then
echo "creating dir ${thisDir}"
mkdir -p -m 0777 "${thisDir}"
chown -R "${USER}.${USER}" "${thisDir}"
mkdir -p 0777 "${thisDir}"
chown -R "${USER}:${USER}" "${thisDir}"
fi
done
if [[ ! -f "${HOME}/config/arm.yaml" ]] ; then
echo "creating example ARM config ${HOME}/config/arm.yaml"
cp /opt/arm/docs/arm.yaml.sample "${HOME}/config/arm.yaml"
chown "${USER}.${USER}" "${HOME}/config/arm.yaml"
fi
if [[ ! -f "${HOME}/config/apprise.yaml" ]] ; then
echo "creating example apprise config ${HOME}/config/apprise.yaml"
cp /opt/arm/docs/apprise.yaml "${HOME}/config/apprise.yaml"
chown "${USER}.${USER}" "${HOME}/config/apprise.yaml"
fi
if [[ ! -f "${HOME}/.abcde.conf" ]] ; then
echo "creating example abcde config ${HOME}/.abcde.conf"
cp /opt/arm/setup/.abcde.conf "${HOME}/.abcde.conf"
ln -sv "${HOME}/.abcde.conf" "${HOME}/config/.abcde.conf"
chown "${USER}.${USER}" "${HOME}/.abcde.conf"
fi

# setup config files if not found
mkdir -p /etc/config
CONFS="arm.yaml apprise.yaml .abcde.conf"
for conf in $CONFS; do
thisConf="/etc/config/${conf}"
if [[ ! -f "${thisConf}" ]] ; then
echo "creating config file ${thisConf}"
cp "/opt/arm/setup/${thisConf}" "/etc/config/${thisConf}"
fi
done
chown -R "${USER}:${USER}" /etc/config/

[[ -h /dev/cdrom ]] || ln -sv /dev/sr0 /dev/cdrom

Expand Down
36 changes: 14 additions & 22 deletions scripts/installers/ubuntu-20.04-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ function clone_arm() {
sudo chown -R arm:arm arm
}

function create_abcde_symlink() {
if ! [[ -z $(find /home/arm/ -type l -ls | grep ".abcde.conf") ]]; then
sudo rm /home/arm/.abcde.conf
fi
sudo ln -sf /opt/arm/setup/.abcde.conf /home/arm/
}

function create_arm_config_symlink() {
if ! [[ -z $(find /etc/arm/ -type l -ls | grep "arm.yaml") ]]; then
sudo rm /etc/arm/arm.yaml
fi
sudo ln -sf /opt/arm/arm.yaml /etc/arm/
function setup_config_files() {
# setup config files if not found, DO NOT RESET DURING REINSTALL
mkdir -p /etc/config
CONFS="arm.yaml apprise.yaml .abcde.conf"
for conf in $CONFS; do
thisConf="/etc/config/${conf}"
if [[ ! -f "${thisConf}" ]] ; then
echo "creating config file ${thisConf}"
cp "/opt/arm/setup/${thisConf}" "/etc/config/${thisConf}"
fi
done
chown -R "${USER}:${USER}" /etc/config/
}

function install_arm_live_env() {
Expand All @@ -113,11 +113,7 @@ function install_arm_live_env() {
cd arm
sudo pip3 install -r requirements.txt
sudo cp /opt/arm/setup/51-automedia.rules /etc/udev/rules.d/
create_abcde_symlink
sudo cp docs/arm.yaml.sample arm.yaml
sudo chown arm:arm arm.yaml
sudo mkdir -p /etc/arm/
create_arm_config_symlink
setup_config_files
sudo chmod +x /opt/arm/scripts/thickclient/arm_wrapper.sh
sudo chmod +x /opt/arm/scripts/update_key.sh
}
Expand All @@ -140,11 +136,7 @@ function install_arm_dev_env() {
clone_arm
cd arm
sudo pip3 install -r requirements.txt
create_abcde_symlink
sudo cp docs/arm.yaml.sample arm.yaml
sudo chown arm:arm arm.yaml
sudo mkdir -p /etc/arm/
create_arm_config_symlink
setup_config_files

# allow developer to write to the installation
sudo chmod -R 777 /opt/arm
Expand Down

0 comments on commit b31572b

Please sign in to comment.