#!/bin/bash
#
EMU=SBox_0.0.4-8.x86
case $1 in
install)
if [ -f /var/bin/$EMU >>/dev/null 2>&1 ];
then
echo -e "\n\t\t\033[1;31;40m$EMU \033[1;37;40mbereits installiert\033[0m\n"
exit 0
fi
echo -e "\n\t\t\033[1;37;40mInstalliere \033[1;32;40m$EMU\033[0m"
chmod 755 sbox.conf
chmod 755 users.sbox
chmod 755 SBox_0.0.4-8.x86.rotate
chmod 755 $EMU
if [ -d /usr/cs/Cams/ >>/dev/null 2>&1 ];
then
echo -e "\t\t\033[1;37;40mOrdner \033[1;32;40m/usr/cs/Cams/ \033[1;37;40mbereits vorhanden\033[0m"
else
mkdir /usr/cs/Cams/
fi
if [ -d /var/bin >>/dev/null 2>&1 ];
then
echo -e "\t\t\033[1;37;40mOrdner \033[1;32;40m/var/bin \033[1;37;40mbereits vorhanden\033[0m"
else
mkdir /var/bin
fi
if [ -d /var/etc >>/dev/null 2>&1 ];
then
echo -e "\t\t\033[1;37;40mOrdner \033[1;32;40m/var/etc \033[1;37;40mbereits vorhanden\033[0m"
else
mkdir /var/etc
fi
if [ -f /var/etc/sbox.conf >>/dev/null 2>&1 ];
then
echo -e "\t\t\033[1;37;40mDatei \033[1;32;40m /var/etc/sbox.conf \033[1;37;40mbereits vorhanden\033[0m"
else
cp sbox.conf /var/etc
fi
if [ -f /var/etc/users.sbox >>/dev/null 2>&1 ];
then
echo -e "\t\t\033[1;37;40mDatei \033[1;32;40m /var/etc/sbox.conf \033[1;37;40mbereits vorhanden\033[0m"
else
cp users.sbox /var/etc
fi
if [ -L /usr/bin/sbox.conf >>/dev/null 2>&1 ];
then
echo -e "\t\t\033[1;37;40mLink \033[1;32;40m/usr/bin/sbox.conf \033[1;37;40mbereits vorhanden\033[0m"
else
ln -s /var/etc/sbox.conf /usr/bin/sbox.conf
fi
cp SBox_0.0.4-8.x86.rotate /usr/cs/Cams/
cp $EMU /var/bin
cp SBox_0.0.4-8.x86.sh /usr/cs/Cams/
sed "s/##Installierte EMUs/##Installierte EMUs\n#\t$EMU/" /usr/cs/cs.conf > /cs.conf
cp /cs.conf /usr/cs/cs.conf
rm /cs.conf
echo -e "\t\t\033[1;37;40mInstallation des \033[1;32;40m$EMU \033[1;37;40merfolgreich\033[0m\n"
;;
uninstall)
if [ -f /var/bin/$EMU >>/dev/null 2>&1 ];
then
echo -e "\n\t\t\033[1;37;40mDeinstalliere \033[1;32;40m$EMU\033[0m"
rm -f /var/bin/$EMU
rm -f /usr/cs/Cams/SBox_0.0.4-8.x86.sh
rm -f /usr/cs/Cams/SBox_0.0.4-8.x86.rotate
sed -e "/#\t$EMU/"d /usr/cs/cs.conf > /cs.conf
cp /cs.conf /usr/cs/cs.conf
rm /cs.conf
echo -e "\t\t\033[1;37;40mDeinstallation des \033[1;32;40m$EMU \033[1;37;40merfolgreich\033[0m\n"
else
echo -e "\n\t\t\033[1;31;40m$EMU \033[1;37;40mnicht installiert\033[0m\n"
exit 0
fi
;;
esac
exit 0