#!/usr/bin/env bash # otrv3p-install-opensuse.sh version="0.0.7" # 2021-01-05 # https://raw.githubusercontent.com/gCurse/support/master/otrv3p_installation_scripts/otrv3p-install-opensuse_leap.sh # BEGIN LICENSE # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compiled # binary, for any purpose, commercial or non-commercial, and by any # means. # # In jurisdictions that recognize copyright laws, the author or authors # of this software dedicate any and all copyright interest in the # software to the public domain. We make this dedication for the benefit # of the public at large and to the detriment of our heirs and # successors. We intend this dedication to be an overt act of # relinquishment in perpetuity of all present and future rights to this # software under copyright law. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # For more information, please refer to # END LICENSE # Made by gcurse.github.io # colors RED='\033[1;31m' BLUE='\033[1;34m' NOC='\033[0m' # no color check_root () { ## Check if we are root if [ "$(id -u)" != "0" ]; then root=0 else root=1 fi } create_desktop_file () { echo "otrv3p:create_desktop_file: Erzeuge otrv3p-git.desktop in $HOME/.local/share/applications" | tee -a /tmp/otrv3p-install.log echo "[Desktop Entry] Type=Application Name=OTR-Verwaltung3p-git GenericName=Verwaltung von OTR-Dateien GenericName[en]=Management of OTR-Files Comment=Dateien von onlinetvrecorder.com verwalten: Schneiden, Schnitte betrachten, Cutlists bewerten... Comment[en]=Manage files from onlinetvrecorder.com : decode, cut, review cuts, rate cutlists... Categories=AudioVideo;AudioVideoEditing; Exec=$HOME/otr-verwaltung3p/bin/otrverwaltung3p Terminal=0 Icon=$HOME/otr-verwaltung3p/data/media/icon.png " > $HOME/.local/share/applications/otrv3p-git.desktop } install_deps () { check_root if [ $root = 1 ]; then if [ ! -e /tmp/otrv3p-install.log ]; then touch /tmp/otrv3p-install.log; fi chown root /tmp/otrv3p-install.log && chmod 666 /tmp/otrv3p-install.log echo "otrv3p:install_deps: Installiere Abhängigkeiten" | tee -a /tmp/otrv3p-install.log for package in ffmpeg-3 \ ffmsindex \ gstreamer-plugin-python \ gstreamer-plugins-bad \ gstreamer-plugins-base \ gstreamer-plugins-good \ gstreamer-plugins-libav \ gstreamer-plugins-ugly \ gstreamer-utils \ mediainfo \ mediainfo-gui \ mkvtoolnix \ mpv \ python3-appdirs \ python3-cairo \ python3-gobject \ python3-gobject-cairo \ python3-gobject-Gdk \ python3-pip \ python3-psutil \ python3-requests \ typelib-1_0-Gst-1_0 \ typelib-1_0-GstPbutils-1_0 \ typelib-1_0-GstPlayer-1_0 \ typelib-1_0-GstVideo-1_0 \ typelib-1_0-Gtk-3_0 \ xdg-user-dirs-gtk \ git-core \ x264; do ## Only install packages if they are not already installed rpm -q "$package" > /dev/null 2>&1 || zypper --non-interactive install "$package" | tee -a /tmp/otrv3p-install.log done if [ $? = 0 ]; then echo -e "Alle Abhängigkeiten sind (jetzt) installiert.\n"; fi exit else echo -e "\n\n${RED}otrv3p:install_deps: Diese Skriptfunktion muss als root ausgeführt werden${NOC}\n\n" | tee -a /tmp/otrv3p-install.log exit fi } install_otrv3p_git () { check_root if [ $root = 0 ]; then cd $HOME if [[ -d "otr-verwaltung3p" ]]; then echo -e "otrv3p:install_otrv3p_git: Das Verzeichnis $HOME/otr-verwaltung3p existiert. Das Repo wird nicht geklont." | tee -a /tmp/otrv3p-install.log cd otr-verwaltung3p git checkout --track origin/development echo -e "otrv3p:install_otrv3p_git: Bestehendes Repo wurde auf den development-Branch umgestellt." | tee -a /tmp/otrv3p-install.log git pull cd .. echo "no" > /tmp/otrv3pCloneYesNo else git clone --branch development --single-branch --shallow-since=2020-02-14 \ https://github.com/EinApfelBaum/otr-verwaltung3p.git 2>&1 | tee -a /tmp/otrv3p-install.log echo "yes" > /tmp/otrv3pCloneYesNo fi mkdir -p $HOME/.local/share/applications 2>&1 | tee -a /tmp/otrv3p-install.log mkdir -p $HOME/.local/share/otrverwaltung 2>&1 | tee -a /tmp/otrv3p-install.log create_desktop_file echo "otrv3p:install_otrv3p_git: Updating desktop database" | tee -a /tmp/otrv3p-install.log update-desktop-database $HOME/.local/share/applications 2>&1 | tee -a /tmp/otrv3p-install.log exit else echo -e "\n\n${RED}otrv3p:install_otrv3p_git: Diese Skriptfunktion darf nicht als root ausgeführt werden${NOC}\n\n" | tee -a /tmp/otrv3p-install.log exit fi } usage () { echo -e "${BLUE}" echo -e "Die Installation wird in zwei Schritten durchgeführt werden:\n" echo -e " 1. Installation der Abhängigkeiten (Root-Rechte benötigt)." echo -e " 2. Installation der otr-verwaltung3p (ohne Root-Rechte).\n\n" echo -e "Das läuft automatisch ab. Bereit? Dann weiter mit der Eingabetaste, abbrechen mit Strg-C${NOC}" read dummy } check_for_packman () { check_pack=$(zypper repos | grep -i packman | grep -Ei "Ja|Yes") if [ -z "$check_pack" ]; then # packman repo not active echo -e "\n${RED}" echo -e "ACHTUNG: Das Packman Repository wurde nicht gefunden oder ist nicht aktiv!" echo -e "Ohne aktiviertes Packman Repository kann das Programm nicht installiert werden.\n${BLUE}" echo -e "Starte das YaST-Modul Repositories" echo -e "Klick auf 'Hinzufügen' dann 'Community/Gemeinschaftsrepositories' wählen. Auf 'Weiter' klicken." echo -e "Dann Packman auswählen und 'Ok' klicken. Im folgenden Fenster dann wieder Packman markieren" echo -e "und die Priorität von 99 auf 90 ändern. 'Ok' klicken. Fertig (hoffentlich)." echo -e "Danach dieses Skript nochmals starten.${NOC}" exit 1 fi } if [ -z "$1" ]; then check_root if [ $root = 1 ]; then echo -e "\n\n${RED}Dieses Skript darf nicht als root ausgeführt werden${NOC}\n\n" | tee -a /tmp/otrv3p-install.log exit 1 fi #export myhome=$HOME echo -e "\n"$(date +"%Y-%m-%d_%H:%M:%S")" LOG BEGINS\n" >> /tmp/otrv3p-install.log check_for_packman usage elif [ "$1" = "deps" ]; then #myhome="$2" install_deps elif [ "$1" = "prog" ]; then #myhome="$2" install_otrv3p_git else echo -e "\n\n${RED}otrv3p: Das hätte niemals passieren dürfen! THE END${NOC}\n\n" 2>&1 | tee -a /tmp/otrv3p-install.log exit 1 fi # Recursive call echo "otrv3p: Start sudo $0 deps" | tee -a /tmp/otrv3p-install.log sudo "$0" deps # $HOME # Recursive call echo "otrv3p: Start $0 prog" | tee -a /tmp/otrv3p-install.log "$0" prog # $HOME clone=$(cat /tmp/otrv3pCloneYesNo) rm /tmp/otrv3pCloneYesNo echo -e '\n\nPlease report any issues at https://github.com/EinApfelBaum/otr-verwaltung3p/issues'