#!/bin/bash # This is AnyDesk bundle update script for Porteus # Version 2023-04-14 # Copyright 2023 Blaze admin at ublaze.ru # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Root check if [ `whoami` != "root" ]; then echo -e "\nYou need to be root to run this script.\n" exit 1 fi PRGNAM=${PRGNAM:-anydesk} RHEL=${RHEL:-el8} VERSION=$(lynx -source "https://download.anydesk.com/linux/" | grep "_x86_64.rpm
$" | sort -u | tail -1 | cut -d'_' -f2 | cut -d'-' -f1) SOURCE=$(echo https://download.anydesk.com/linux/"$PRGNAM"-"$VERSION"-1."$RHEL".x86_64.rpm) BUILD=${BUILD:-1} BOLD=${BOLD:-"\e[1m"} CYAN=${CYAN:-"\e[96m"} GREEN=${GREEN:-"\e[92m"} RED=${RED:-"\e[31m"} RESET=${RESET:-"\e[0m"} CWD=$(pwd) TMPDIR=/tmp/portch PKG=$TMPDIR/package-$PRGNAM PKGINFO=$PKG/var/lib/pkgtools/packages OUTPUT=${OUTPUT:-/tmp} ARCH=$( uname -m ) cleanup(){ [ -d $TMPDIR ] && rm -rf $TMPDIR [ -d $PKG ] && rm -rf $PKG exit } # Check if AnyDesk installed in the system if [[ -f "/usr/bin/anydesk" ]]; then MYVER=${MYVER:-`anydesk --version`} fi if [ "$MYVER" == "$VERSION" ]; then echo -e "You have the latest ${GREEN}$MYVER${RESET} version of $PRGNAM" sleep 5 exit else read -p "$(echo -e Would you like to build $PRGNAM ${GREEN}$VERSION${RESET} xzm module? [y/n])" -n 1 -r -s && echo if [[ $REPLY =~ ^[Yy]$ ]]; then echo "We continue the execution of the $0 script" &>/dev/null else exit fi fi rm -rf $PKG mkdir -p $TMPDIR $PKG cd $PKG # Download AnyDesk # We download RHEL AnyDesk package coz it have some deps inside echo -e "\nDownloading ${CYAN}${BOLD}${PRGNAM}-${VERSION}${RESET}" wget -q --show-progress "$SOURCE" for i in `find . -type f | fgrep .rpm | sort`; do rpm2cpio $i | cpio -idmv &>/dev/null; done rm -f *.rpm # Download dependencies and make symbolic links echo -e "\nDownloading ${CYAN}${BOLD}dependencies${RESET}" wget -q --show-progress -c ftp://ftp.osuosl.org/pub/slackware/slackware64-current/slackware64/l/gtk+2-*-x86_64-*.txz -O - | tar -xJ -C $PKG usr/lib64/ rm -rf $PKG/usr/lib64/{girepository-1.0,gtk-2.0,pkgconfig,libgailutil.*} ( cd usr/lib64 ; rm -rf libgdk-x11-2.0.so ) ( cd usr/lib64 ; rm -rf libgdk-x11-2.0.so.0 ) ( cd usr/lib64 ; rm -rf libgtk-x11-2.0.so ) ( cd usr/lib64 ; rm -rf libgtk-x11-2.0.so.0 ) ( cd usr/lib64 ; ln -sf libgdk-x11-2.0.so.0.*.* libgdk-x11-2.0.so ) ( cd usr/lib64 ; ln -sf libgdk-x11-2.0.so.0.*.* libgdk-x11-2.0.so.0 ) ( cd usr/lib64 ; ln -sf libgtk-x11-2.0.so.0.*.* libgtk-x11-2.0.so ) ( cd usr/lib64 ; ln -sf libgtk-x11-2.0.so.0.*.* libgtk-x11-2.0.so.0 ) mv $PKG/usr/lib64/anydesk/* $PKG/usr/lib64 rm -rf $PKG/usr/lib64/anydesk rm -f $PKG/usr/bin/anydesk mv $PKG/usr/libexec/* $PKG/usr/bin rm -rf $PKG/usr/{libexec,man} rm -rf $PKG/usr/share/{doc,man} rm -rf $PKG/etc/* mkdir $PKG/etc/rc.d rm -rf $PKG/var # Create rc.service in Slackware BSD style wget -q -P $PKG/etc/rc.d https://slackbuilds.org/slackbuilds/15.0/network/anydesk/rc.anydesk # Add AnyDesk global settings echo '#!/bin/bash psu /usr/bin/anydesk --admin-settings' > $PKG/usr/bin/anydesk-global-settings chmod 755 $PKG/usr/bin/anydesk-global-settings ### fake Slackware type package info: super dumb version mkdir -p $PKGINFO echo "PACKAGE NAME: $PRGNAM-$VERSION-$ARCH" > $PKGINFO/$PRGNAM-$VERSION-$ARCH cat >> $PKGINFO/$PRGNAM-$VERSION-$ARCH << EOM PACKAGE DESCRIPTION: anydesk: anydesk (Remote Desktop Software) anydesk: anydesk: Connect to a computer remotely, be it from the other end of the anydesk: office or halfway around the world. AnyDesk ensures secure and anydesk: reliable remote desktop connections for IT professionals anydesk: and on-the-go individuals alike. AnyDesk works across all your anydesk: devices and operating systems: Windows, Linux, macOS, iOS, Android, anydesk: FreeBSD and even your Raspberry Pi! anydesk: anydesk: Homepage: http://www.anydesk.com anydesk: FILE LIST: EOM find * | grep -v var >> $PKGINFO/$PRGNAM-$VERSION-$ARCH dir2xzm $PKG $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD.xzm # Check on AnyDesk xzm file exists in /tmp if [ -f "$OUTPUT/$PRGNAM-$VERSION-x86_64-${BUILD}.xzm" ]; then echo -e "\n${BOLD}Your $PRGNAM module is at: ${GREEN}${BOLD}$OUTPUT/$PRGNAM-$VERSION-x86_64-${BUILD}.xzm${RESET}\n${BOLD}Please copy it to your modules folder to survive a reboot.${RESET}\n" else echo -e "\n${RED}${BOLD}Failed. Your $PRGNAM module is not built.${RESET}\n" fi cleanup