assistant.sh 2.1 KB
Newer Older
1 2 3
#!/bin/sh

PKGNAME=assistant
4
SKIPREPACK=1
5
SUPPORTEDARCHES="x86_64 aarch64"
6
VERSION="$2"
7 8 9 10
DESCRIPTION="Assistant (Ассистент) from the official site"

. $(dirname $0)/common.sh

11
warn_version_is_not_supported
12

13 14
arch="$(epm print info -a)"
pkg="$(epm print info -p)"
15

16 17 18 19
# some locale depend troubles (ALT with bash 4 needs LANG=ru_RU.UTF-8, Ubuntu with bash 5 needs LANG=C.UTF-8)
#URL="https://мойассистент.рф/скачать"
URL="https://xn--80akicokc0aablc.xn--p1ai/%D1%81%D0%BA%D0%B0%D1%87%D0%B0%D1%82%D1%8C"

20 21
# parse vendor site
tmpfile=$(mktemp)
22
trap "rm -f $tmpfile" EXIT
23
eget -q -O- "$URL" | grep -A200 "Ассистент для LINUX" >$tmpfile
24

25
url_by_text()
26
{
27
    local text="$1"
28
    local pkg="$(cat $tmpfile | grep -B1 "$text" | head -n1 | grep "/Download/" | sed -e 's|.*href="||' -e 's|".*||')"
29
    [ -n "$pkg" ] || fatal "Can't get Download href for $text"
30 31
    #echo "https://мойассистент.рф$pkg"
    echo "https://xn--80akicokc0aablc.xn--p1ai$pkg"
32 33
}

34 35
case $arch-$pkg in
    x86_64-rpm)
36
        URL="$(url_by_text "Скачать RPM пакет")"
37 38
        ;;
    x86_64-deb)
39 40 41 42 43 44 45
        URL="$(url_by_text "Скачать DEB пакет")"
        ;;
    aarch64-rpm)
        URL="$(url_by_text "Скачать RPM пакет для ARM устройств")"
        ;;
    aarch64-deb)
        URL="$(url_by_text "Скачать DEB пакет для ARM устройств")"
46 47
        ;;
    *)
48
        fatal "$(epm print info -e) is not supported (arch $arch, package type is $pkg)"
49 50 51 52 53 54 55
        ;;
esac

# after repack on ALT:
#  assistant: Требует: /lib/init/vars.sh но пакет не может быть установлен
#             Требует: libyuv.so()(64bit) но пакет не может быть установлен

56
[ "$(epm print info -s)" = "alt" ] && epmi --skip-installed fontconfig-disable-type1-font-for-assistant
57

58
# TODO: disable scripts (see /etc/eepm/pkgallowscripts.list)
59
LANG=ru_RU.UTF8 epm install "$URL" || exit
60

61 62
echo "Note: original package runs /opt/assistant/scripts/setup.sh --install during install.."
echo "It is dangerous. Use this package at your own risk."