Skip to content

Commit

Permalink
Update debian-install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
theource authored Jul 2, 2022
1 parent 62dffe8 commit d19a189
Showing 1 changed file with 52 additions and 41 deletions.
93 changes: 52 additions & 41 deletions scripts/installers/debian-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ function install_arm_build_tools(){
}

function install_arm_requirements() {
mkdir -p /home/arm
mkdir -p /etc/arm/config
install_arm_build_tools
echo -e "${RED}Installing ARM requirements${NC}"
apt update -y
apt-get install -y \
echo -e "${RED}Installing ARM requirments${NC}"
apt update -qqy
apt-get install -qqy \
build-essential \
libcurl4-openssl-dev libssl-dev \
libudev-dev \
Expand All @@ -89,6 +91,10 @@ function install_arm_requirements() {
python3-psutil \
python3-pyudev \
python3-testresources \
build-essential \
libssl-dev \
libffi-dev \
python-dev \
abcde \
eyed3 \
atomicparsley \
Expand All @@ -98,24 +104,42 @@ function install_arm_requirements() {
flac \
glyrc \
default-jre-headless \
libavcodec-extra
libavcodec-extra \
net-tools

apt install -y \
handbrake-cli \
apt install -qqy \
imagemagick \
at \
libdvd-pkg lsdvd
dpkg-reconfigure --frontend noninteractive libdvd-pkg
build_makemkv
build_handbrakecli
}

function build_handbrakecli(){
if [ -d "./HandBrake" ]
then
echo "HandBrake build exists. Removing!"
rm -R HandBrake
fi
sudo apt-get install -yqq appstream autoconf automake autopoint build-essential cmake git libass-dev libbz2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjansson-dev liblzma-dev libmp3lame-dev libnuma-dev libogg-dev libopus-dev libsamplerate-dev libspeex-dev libtheora-dev libtool libtool-bin libturbojpeg0-dev libvorbis-dev libx264-dev libxml2-dev libvpx-dev m4 make meson nasm ninja-build patch pkg-config python tar zlib1g-dev libva-dev libdrm-dev
## Handbrake - we use this one for the VCE preset
git clone https://github.com/HandBrake/HandBrake.git && cd HandBrake
# Only uncomment if you need vce_h264
# wget https://raw.githubusercontent.com/1337-server/HandBrake/master/libhb/handbrake/preset_builtin.h libhb/handbrake/preset_builtin.h
./configure --disable-gtk --enable-qsv --enable-vce --launch-jobs=$(nproc) --launch
sudo make -j$(nproc) --directory=build install
cd .. && rm -R HandBrake
#sudo apt-get -yqq remove appstream autoconf automake autopoint build-essential cmake git libass-dev libbz2-dev libfontconf

}

function build_makemkv(){
echo -e "${RED}Setting up directories and getting makeMKV files${NC}"
mkdir -p ./makeMKV
cd ./makeMKV
mkdir -p /makeMKV && cd /makeMKV

echo -e "${RED}Finding current MakeMKV version${NC}"
mmv=$(curl -s https://www.makemkv.com/download/ | grep -o '[0-9.]*.txt' | sed 's/.txt//')
mmv=$(curl -s https://www.makemkv.com/download/ | grep -o [0-9.]*.txt | sed 's/.txt//')
echo -e "MakeMKV Current Version: ${mmv}"
echo -e "${RED}Downloading MakeMKV sha, bin, and oss${NC}"
# As MakeMKV is currently suspended I've included links to the wayback machine
Expand All @@ -139,17 +163,25 @@ function build_makemkv(){
mkdir -p ./tmp
echo -e "${RED}Installing MakeMKV${NC}"
./configure 2>&1 >/dev/null
make -s
make -s -j$(nproc)
make install

cd ../makemkv-bin-$mmv
mkdir -p ./tmp
echo "yes" >> ./tmp/eula_accepted
make -s
make -s -j$(nproc)
make install
cd ~
rm -R /makeMKV
}

function remove_existing_arm() {

if [ -d "/opt/arm" ]
then
echo "ARM install path exists. Removing!"
rm -R /opt/arm
fi
##### Check if the ArmUI service exists in any state and remove it
if systemctl list-unit-files --type service | grep -F armui.service; then
echo -e "${RED}Previous installation of ARM service found. Removing...${NC}"
Expand All @@ -161,27 +193,12 @@ function remove_existing_arm() {
}

function clone_arm() {
cd /opt
if [ -d arm ]; then
echo -e "${RED}Existing ARM installation found, backing up config files...${NC}"
rm -rf /etc/arm
mkdir -p /etc/arm/
if [ -f ./arm/arm.yaml ]; then
echo "arm.yaml found"
mv /opt/arm/arm.yaml /etc/arm/backup.arm.yaml
fi
mv /opt/arm/setup/.abcde.conf /etc/arm/backup.abcde.conf
echo -e "${RED}Removing existing ARM installation...${NC}"
rm -rf arm
fi

git clone --recurse-submodules https://github.com/1337-server/automatic-ripping-machine.git arm

cd arm
git submodule update --init --recursive
git submodule update --recursive --remote
cd ..

chown -R arm:arm /opt/arm
find /opt/arm/scripts/ -type f -iname "*.sh" -exec chmod +x {} \;
}
Expand All @@ -190,35 +207,31 @@ function create_abcde_symlink() {
if ! [[ -z $(find /home/arm/ -type l -ls | grep ".abcde.conf") ]]; then
rm /home/arm/.abcde.conf
fi
ln -sf /opt/arm/setup/.abcde.conf /home/arm/
cp --no-clobber /opt/arm/setup/.abcde.conf /etc/arm/config
}

function create_arm_config_symlink() {
if [[ $port_flag ]]; then
echo -e "${RED}Non-default port specified, updating arm config...${NC}"
# replace the default 8080 port with the specified port
sed -e s"/\(^WEBSERVER_PORT:\) 8080/\1 ${PORT}/" -i /opt/arm/arm.yaml
sed -e s"/\(^WEBSERVER_PORT:\) 8080/\1 ${PORT}/" -i /etc/arm/config/arm.yaml
fi

if ! [[ -z $(find /etc/arm/ -type l -ls | grep "arm.yaml") ]]; then
rm /etc/arm/arm.yaml
fi
ln -sf /opt/arm/arm.yaml /etc/arm/
cp --no-clobber /opt/arm/setup/arm.yaml /etc/arm/config/arm.yaml
}

function install_arm_live_env() {
echo -e "${RED}Installing ARM:Automatic Ripping Machine${NC}"
echo -e "${GREEN}Installing ARM:Automatic Ripping Machine${NC}"
cd /opt
clone_arm
cd arm
sudo -u arm pip3 install -r requirements.txt
cp /opt/arm/setup/51-automedia.rules /etc/udev/rules.d/
cp ./setup/51-automedia.rules /etc/udev/rules.d/
create_abcde_symlink
cp docs/arm.yaml.sample arm.yaml
chown arm:arm arm.yaml
mkdir -p /etc/arm/
cp --no-clobber ./setup/arm.yaml /etc/arm/config/arm.yaml
chown arm:arm /etc/arm/config/arm.yaml
chown arm:arm /etc/arm/config
create_arm_config_symlink
chmod +x /opt/arm/scripts/arm_wrapper.sh
chmod +x /opt/arm/scripts/thickclient/arm_wrapper.sh
chmod +x /opt/arm/scripts/update_key.sh
}

Expand Down Expand Up @@ -287,9 +300,7 @@ function launch_setup() {
add_arm_user
install_arm_requirements
remove_existing_arm

install_arm_live_env

install_python_requirements
setup_autoplay
setup_syslog_rule
Expand Down

0 comments on commit d19a189

Please sign in to comment.