Package not found: openSUSE:Factory/csi-resizer-image

File linphone-appimage.install of Package linphone-appimage

post_install() {
    # --- Variables ---
    TITLE="Linphone AppImage"
    # P A C K A G E V E R S I O N will be replaced to something like 5.3.0 to allow
    # specific download but not really needed if 'latest_app' link points
    # to the latest AppImage file
    pkgver=PACKAGEVERSION
    executable=linphone
    executable_tag=appimage
    APPIMAGE="https://linphone.org/releases/linux/latest"
    APPIMAGE="https://linphone.org/releases/linux/latest_app"
    APPIMAGE="https://download.linphone.org/releases/linux/app/Linphone-6.0.1-CallEdition-x86_64.AppImage"
    APPIMAGE="https://download.linphone.org/releases/linux/app/Linphone-${pkgver}-x86_64.AppImage"
    menuFileNameMinimized="${executable}-${executable_tag}-minimized.desktop"
    # --- End variables ---
    # Download Linphone-Desktop AppImage file to the correct location
    echo "Closing ${executable}.AppImage ..."
    pkill AppRun.wrapped
    echo "wait a few seconds to terminate ${executable}.AppImage ..."
    sleep 5s
    wget -O /opt/appimages/${executable}.AppImage "${APPIMAGE}"
    chmod 755 /opt/appimages/${executable}.AppImage
    # For all users on the system, enable auto-start if they do not have auto-start enabled already:
    # Users on the system
    USERS=$(awk -F':' '{ print $1 }' /etc/passwd)
    # echo USERS=$USERS
    for user in $USERS; do
        unset FLAG
        FLAG=-1
        ISHUMAN=-1
        if [ -d "/home/$user/.config/autostart" ]; then
            OWNER=$(stat -c '%U' "/home/$user/.config/autostart")
            GROUPOWNER=$(stat -c '%G' "/home/$user/.config/autostart")
            if [ "$OWNER" != "$user" ]; then
                chown -R $user "/home/$user/.config/autostart"
            fi
            if [ "$GROUPOWNER" != "$user" ]; then
                chown -R :$user "/home/$user/.config/autostart"
            fi
            # echo "$user has .config/autostart folder"
            ISHUMAN=1
            sleep 1
        else
            # echo "$user has no autostart folder"
            if [ -d "/home/$user/.local/share" ]; then
                # echo "$user has .local/share folder"
                mkdir -p "/home/$user/.config/autostart"
                # echo "change owner of /home/$user/.config/autostart"
                chown -R $user:$user "/home/$user/.config/autostart"
                ISHUMAN=1
            fi
        fi
        if [ $ISHUMAN -eq 1 ] ; then
            if [ -n "$(find "/home/$user/.config/autostart" -name *${executable}*.desktop -print | xargs )" ]; then
                # echo not empty, 1 equals true
                # echo "Found a file called *${executable}*.desktop"
                FLAG=1
            else
                # echo empty, 0 equals false
                FLAG=0
            fi
            if [ $FLAG -eq 1 ] ; then
                # Remove all previous auto-start .desktop icons
                find "/home/$user/.config/autostart" -name *${executable}*.desktop -type f -exec rm -f {} + 2>/dev/null
            fi
            if [ $FLAG -eq 0 ] || [ $FLAG -eq 1 ] ; then
                # This is a human user.
                # echo "$user is a human user"
                # Create auto-start desktop file.
                # This starts application minimized or --iconified
                echo "[Desktop Entry]" > /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Encoding=UTF-8" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Name=${TITLE}" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Name[fr]=${TITLE}" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Name[sv]=${TITLE}" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Name[cs]=${TITLE}" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "GenericName=SIP Phone" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Comment=A libre SIP client" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Comment[sv]=En fri SIP-telefon-klient" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Comment[fr]=Un libre SIP-client" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Comment[cs]=Libre SIP-klient" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Type=Application" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Icon=${executable}-${executable_tag}" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Terminal=false" >> /home/$user/.config/autostart/$menuFileNameMinimized
                #echo "Exec=/usr/bin/${executable} --iconified 'call sip-address=%u'" >> /home/$user/.config/autostart/$menuFileNameMinimized
                #echo "Exec=/opt/appimages/${executable}.AppImage --iconified 'call sip-address=%u'" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Exec=firejail --appimage /opt/appimages/${executable}.AppImage --iconified" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "MimeType=x-scheme-handler/sip;x-scheme-handler/sip-${executable};x-scheme-handler/sip;x-scheme-handler/sips-${executable};x-scheme-handler/sips;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/${executable}-config;" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "X-PulseAudio-Properties=media.role=phone" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "StartupWMClass=${executable};${executable}" >> /home/$user/.config/autostart/$menuFileNameMinimized
                echo "Categories=Application;Network;Telephony;Internet" >> /home/$user/.config/autostart/$menuFileNameMinimized
                chmod +x "/home/$user/.config/autostart/$menuFileNameMinimized"
                if [ -f /home/$user/.config/autostart/${menuFileNameMinimized} ]; then
                    echo "auto-start successfully enabled for user $user"
                    # echo "changing ownership of /home/$user/.config/autostart/${menuFileNameMinimized} to $user:$user"
                    chown $user:$user /home/$user/.config/autostart/${menuFileNameMinimized}
                fi
            fi
        else
            # echo "$user probably not a real user"
            true
        fi 
    done
}

post_upgrade() {
    # --- Variables ---
    # P A C K A G E V E R S I O N will be replaced to something like 5.3.0 to allow
    # specific download but not really needed if 'latest_app' link points
    # to the latest AppImage file
    pkgver=PACKAGEVERSION
    APPIMAGE="https://linphone.org/releases/linux/latest"
    APPIMAGE="https://linphone.org/releases/linux/latest_app"
    APPIMAGE="https://download.linphone.org/releases/linux/app/Linphone-6.0.1-CallEdition-x86_64.AppImage"
    APPIMAGE="https://download.linphone.org/releases/linux/app/Linphone-${pkgver}-x86_64.AppImage"
    executable=linphone
    executable_tag=appimage
    menuFileNameMinimized="${executable}-${executable_tag}-minimized.desktop"
    # --- End variables ---
    # Download Linphone-Desktop AppImage file to the correct location
    echo "Closing ${executable}.AppImage ..."
    pkill AppRun.wrapped
    echo "wait a few seconds to terminate ${executable}.AppImage ..."
    sleep 5s
    wget -O /opt/appimages/${executable}.AppImage "${APPIMAGE}"
    chmod 755 /opt/appimages/${executable}.AppImage
}

post_remove() {
    # --- Variables ---
    executable_tag=appimage-linphone
    executable=linphone
    executable_tag=appimage
    menuFileNameMinimized="${executable}-${executable_tag}-minimized.desktop"
    # --- End variables ---
    # For all users on the system, disable auto-start:
    USERS=$(awk -F':' '{ print $1 }' /etc/passwd)
    for user in $USERS; do
        #if [ -d "/home/$user/.local/share/icons/hicolor" ]; then
        #rm -f "/home/$user/.local/share/icons/hicolor/scalable/apps/${executable}.svg" 
        #touch "/home/$user/.local/share/icons/hicolor"
        #gtk-update-icon-cache "/home/$user/.local/share/icons/hicolor" > /dev/null       
        #fi
        #if [ -d "/home/$user/.local/share/applications" ]; then
        #    rm -f "/home/$user/.local/share/applications/${menuFileNameMinimized}"
        #fi
        if [ -d "/home/$user/.config/autostart" ]; then
            rm -f "/home/$user/.config/autostart/${menuFileNameMinimized}" 
        fi
    done
}
openSUSE Build Service is sponsored by