mystic/mystic/install-v3.sh

84 lines
3.9 KiB
Bash

#UPSTREAM="downloads"
UPSTREAM="downloads/prealpha"
MYSTIC_VER="112a49"
echo -e "Plz set the install dir the same as bevor"
echo -e "${DGN}Install Mystic to: ${BGN}$MYSTIC_DIR${CL}"
read -p "Press enter to continue"
msg_info "Starting ${APP} Installation"
apt install -y python3 python2 libpython2.7 arj zip rar unrar &>/dev/null
wget -N http://www.mysticbbs.com/${UPSTREAM}/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} -O $MSTEMPDIR/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null
rm -rf $MSTEMPDIR/mystic-${MYSTIC_VER} &>/dev/null
mkdir -p $MSTEMPDIR/mystic-${MYSTIC_VER} &>/dev/null
pushd $MSTEMPDIR/mystic-${MYSTIC_VER} &>/dev/null
if [ "${MYSTIC_EXT}" = "rar" ]; then
unrar x $MSTEMPDIR/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null
elif [ "${MYSTIC_EXT}" = "zip" ]; then
unzip $MSTEMPDIR/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null
else
exit 1
fi
chmod +x install &>/dev/null
./install
popd &>/dev/null
msg_ok "Finisched ${APP} Installation"
pushd ${MYSTIC_DIR} &>/dev/null
apt install -y patch &>/dev/null
patch -p0 -i $MSTEMPDIR/mystic/mystic/patches/mutil-ini-echounlink.patch &>/dev/null
popd &>/dev/null
msg_info "Creating ${APP} und setting Permissions in ${MYSTIC_DIR}"
if [ -z "${GROUP}" ]; then
groupadd mystic &>/dev/null
fi
if [ -z "${USER}" ]; then
useradd -m --home-dir ${MYSTIC_DIR} -g mystic mystic &>/dev/null
fi
chown mystic:mystic -R ${MYSTIC_DIR} &>/dev/null
find ${MYSTIC_DIR} -name '*.txt' -type f -exec dos2unix {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.ini' -type f -exec dos2unix {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.txt' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.ini' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.dat' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.ans' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.asc' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.hlp' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.mnu' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.mnu' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.mps' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.mpx' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.mpy' -type f -exec chmod 0664 {} \; &>/dev/null
find ${MYSTIC_DIR} -name '*.ms' -type f -exec chmod 0664 {} \; &>/dev/null
msg_ok "Creating ${APP} und setting Permissions in ${MYSTIC_DIR}"
msg_info "Installing ${APP} Systemd Start/Stop Scripts and Service File"
MID=$(id -u mystic)
sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" $MSTEMPDIR/mystic/mystic/mis-start.sh > ${MYSTIC_DIR}/mis-start
chmod +x ${MYSTIC_DIR}/mis-start
sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" $MSTEMPDIR/mystic/mystic/mis-stop.sh > ${MYSTIC_DIR}/mis-stop
chmod +x ${MYSTIC_DIR}/mis-stop
sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" $MSTEMPDIR/mystic/mystic/mis.service > /etc/systemd/system/mystic.service
sed -e "s!@MID@!${MID}!g" $MSTEMPDIR/mystic/mystic/mystic.conf.tmpfiles.d > /etc/tmpfiles.d/mystic.conf
systemctl daemon-reload
msg_ok "Installing ${APP} Systemd Start/Stop Scripts and Service File"
msg_info "Setting up ${APP} Official lha (be patient compiling lha)"
apt install -y build-essential binutils make csh g++ sed gawk autoconf automake autotools-dev &>/dev/null
wget -N https://github.com/jca02266/lha/archive/refs/tags/release-20211125.zip -O $MSTEMPDIR/lha-20211125.zip &>/dev/null
rm -rf $MSTEMPDIR/lha-release-20211125 &>/dev/null
pushd $MSTEMPDIR &>/dev/null
unzip lha-20211125.zip &>/dev/null
popd &>/dev/null
pushd $MSTEMPDIR/lha-release-20211125 &>/dev/null
aclocal &>/dev/null
autoheader &>/dev/null
automake -a &>/dev/null
autoconf &>/dev/null
./configure &>/dev/null
make &>/dev/null
make install &>/dev/null
popd &>/dev/null
msg_ok "Setting up ${APP} Official lha (be patient compiling lha)"