Jump to content

TheBB

Moderators
  • Posts

    2,410
  • Joined

  • Last visited

  • Days Won

    51

Posts posted by TheBB

  1. 21 час назад, Buddha сказал:

    Тут же не совсем явно что происходит

    Происходит следующее: ser2net имеет 2 конфига, старого формата - "/opt/etc/ser2net.conf" и нового - "/opt/etc/ser2net/ser2net.yaml", приоритет за новым. При старте, если есть нов. формата и не указано иного, ser2net цепляет его ("/opt/etc/ser2net/ser2net.yaml").

    ~ # strace -ffff -vvvv -e openat ser2net -u -P /opt/var/run/ser2net.pid
    openat(AT_FDCWD, "/opt/lib/tls/aarch64/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    openat(AT_FDCWD, "/opt/lib/tls/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    openat(AT_FDCWD, "/opt/lib/aarch64/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    openat(AT_FDCWD, "/opt/lib/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libgensio.so.0", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libnsl.so.1", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/etc/ser2net/ser2net.yaml", O_RDONLY) = 6		<= oops!
    openat(AT_FDCWD, "/opt/etc/localtime", O_RDONLY|O_CLOEXEC) = 6
    strace: Process 22977 attached
    strace: Process 22978 attached
    [pid 22976] +++ exited with 0 +++
    [pid 22978] openat(AT_FDCWD, "/opt/var/run/ser2net.pid", O_WRONLY|O_CREAT|O_TRUNC, 0666 <unfinished ...>
    [pid 22977] +++ exited with 0 +++
    ...
    Цитата

    ...
    ser2net: Valid parameters are:
      -c <config file> - use a config file besides /etc/ser2net/ser2net.yaml
      -C <config line> - Handle a single configuration line.  This may be
         specified multiple times for multiple lines.  This is just like a
         line in the config file.  This disables the default config file,
         you must specify a -c after the last -C to have it read a config
         file, too.  The config file must not be yaml.
    ...

    ~ # ser2net -u -P /opt/var/run/ser2net.pid -c /opt/etc/ser2net.conf 
    ser2net:WARNING: Using old config file format, this will go away
    soon.  Please switch to the yaml-based format.
    ~ #

    "под капотом"

    ~ # strace -ffff -vvvv -e openat ser2net -u -P /opt/var/run/ser2net.pid -c /opt/etc/ser2net.conf 
    openat(AT_FDCWD, "/opt/lib/tls/aarch64/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    openat(AT_FDCWD, "/opt/lib/tls/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    openat(AT_FDCWD, "/opt/lib/aarch64/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
    openat(AT_FDCWD, "/opt/lib/libyaml-0.so.2", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libgensio.so.0", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libnsl.so.1", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/opt/etc/ser2net.conf", O_RDONLY) = 6				<= oops!
    ser2net:WARNING: Using old config file format, this will go away
    soon.  Please switch to the yaml-based format.
    openat(AT_FDCWD, "/opt/etc/localtime", O_RDONLY|O_CLOEXEC) = 6
    strace: Process 23056 attached
    [pid 23055] +++ exited with 0 +++
    strace: Process 23057 attached
    [pid 23056] +++ exited with 0 +++
    openat(AT_FDCWD, "/opt/var/run/ser2net.pid", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 0
    ...

    Что делать, теперь решайте сами... )))

    • Thanks 1
  2. http://bin.entware.net/aarch64-k3.10/test/airprint/

    http://bin.entware.net/mipselsf-k3.4/test/airprint/

    http://bin.entware.net/mipssf-k3.4/test/airprint/

    1. установить пакет:

    opkg install airprint

    остальные зависят от модели устройства (напр., для SCX-4220 - `opkg install splix`)

    2. добавить группy для avahi

     echo "nogroup:x:65535:" >> /opt/etc/group

    3. для настройки через web отредактировать файл "/opt/etc/cups/cupsd.conf":

    в строке "Listen localhost:631" удалить запись "localhost" ( Listen localhost:631 => Listen 631)

    добавить в конец каждой секции " <Location />" и "<Location /admin>"  - "Allow @Local"

    4. заметить стартовый скрипт "/opt/etc/init.d/S42avahi-daemon", присвоив другой номер (чтоб не переписывался при переустановке), типа;

    5. запустить сервисы

    /opt/etc/init.d/S20dbus  start
    /opt/etc/init.d/S42avahi-daemon start
    /opt/etc/init.d/S60cupsd  start

    и настроить устройство через "морду" IP:631

    6. создать 2 (два) файла (или забрать готовые)

    7. забрать генератор (curl/wget/копипаста)  https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py

    8. создать файл сервиса устройства для avahi

    python airprint-generate.py -d /opt/etc/avahi/services/

    9. перезапустить сервисы

    /opt/etc/init.d/S42avahi-daemon restart
    /opt/etc/init.d/S60cupsd restart

    10. пытать ипон(ц)а
    ---
    из неявного: имя хоста должно быть с суффиксом .local

    screen_2023-04-09_17:55:05-cups.png

    screen_2023-04-10_18:38:48-airprint.png

    • Thanks 2
    • Upvote 2
  3. Скрытый текст

     

    ~ # rm -rf /opt/var/opkg-lists/*
    ~ # 
    ~ # opkg info prometheus
    ~ # 
    ~ # opkg update
    Downloading http://bin.entware.net/mipselsf-k3.4/Packages.gz
    Updated list of available packages in /opt/var/opkg-lists/entware
    Downloading http://bin.entware.net/mipselsf-k3.4/keenetic/Packages.gz
    Updated list of available packages in /opt/var/opkg-lists/keendev
    ~ # 
    ~ # opkg info prometheus
    Package: prometheus
    Version: 2.42.0-1
    Depends: libc, libssp, librt, libpthread
    Status: unknown ok not-installed
    Section: utils
    Architecture: mipsel-3.4
    Size: 37751366
    Filename: prometheus_2.42.0-1_mipsel-3.4.ipk
    Description: Prometheus, a Cloud Native Computing Foundation project,
     is a systems and service monitoring system. It collects
     metrics from configured targets at given intervals, evaluates
     rule expressions, displays the results, and can trigger alerts
     when specified conditions are observed.
    
    ~ # 
    ~ # opkg install prometheus
    Installing prometheus (2.42.0-1) to root...
    Downloading http://bin.entware.net/mipselsf-k3.4/keenetic/prometheus_2.42.0-1_mipsel-3.4.ipk
    Configuring prometheus.
    ~ # 
    ~ # opkg info prometheus
    Package: prometheus
    Version: 2.42.0-1
    Depends: libc, libssp, librt, libpthread
    Status: install user installed
    Section: utils
    Architecture: mipsel-3.4
    Size: 37751366
    Filename: prometheus_2.42.0-1_mipsel-3.4.ipk
    Conffiles:
     /opt/etc/prometheus/prometheus.yml 6c568c1bdc95b97c1c35e565f4cd337d328eed000551e49b741d94e639e0a78f
    Description: Prometheus, a Cloud Native Computing Foundation project,
     is a systems and service monitoring system. It collects
     metrics from configured targets at given intervals, evaluates
     rule expressions, displays the results, and can trigger alerts
     when specified conditions are observed.
    Installed-Time: 1680769740
    
    ~ #

     

  4. 42 минуты назад, SigmaPlus сказал:

    Попробовал только что по Вашей инструкции. Спасибо, работает, теперь порядок!

    Это не инструкция, а демонстрация. Инструкция тут (с поправкой на отсутствие "Люськи" и прочие Entware specifics)

    Опять же, демонстрация (не забываем экранировать спецсимволы)

    ~ # 
    ~ # uhttpd -m superpass
    $1$$gIQJltLOuZboYpWcWhc5U0
    ~ # 
    ~ # echo "/ext-ui/:root:\$1\$\$gIQJltLOuZboYpWcWhc5U0" > /opt/etc/httpd.conf
    ~ # 
    ~ # /opt/etc/init.d/S80uhttpd restart
     Shutting down uhttpd...              done. 
     Starting uhttpd...              done. 
    ~ # 

     

    • Thanks 2
  5. 21 минуту назад, Jabber сказал:

    Запускал обновление пакетов, завершилось с какими-то ругательствами по уже существующим файлам, не успел посмотреть подробности

    скорее всего на конфиги, изменённые пользователем (защита от перезаписи)

    23 минуты назад, Jabber сказал:

    а есть ли где-то лог opkg upgrade не уверен

    если лог не создавать (перенаправление вывода в файл), его нет.

    • Thanks 1
  6. 16 часов назад, SigmaPlus сказал:

    Этот графический интерфейс очень удобная и полезная вещь, конечно, но очень уж смущает одно нововведение пришедшее с переходом на php8. Имею ввиду открытость для входа. Раньше, графический интерфейс с использованием php5, php7 позволял использовать вход по логину и паролю, что логично. А теперь "милости просим"...  Можно как-то вернуть этот функционал?

    Настраивать не пробовали?

    ~ # uhttpd --help
    ... -r string       Specify basic auth realm ...
    ~ # 
    ~ # 
    ~ # echo "/:adminweb:passwd" > /opt/etc/httpd.conf
    ~ # 
    ~ # cat /opt/etc/uhttpd.conf 
    ...
    OPTS="-p $ADDR:$PORT -h $DOCROOT -i $PHP -r /opt/etc/httpd.conf"
    ~ # 
    ~ # /opt/etc/init.d/S80uhttpd restart
     Shutting down uhttpd...              done. 
     Starting uhttpd...              done. 
    ~ # 

    screen_2023-03-30_13:36:10-extui.png

    • Thanks 1
  7. Вариант №2 (внимательно следим за руками)

    ~ # 
    ~ # ln -sf /opt/lib/python3.10/site-packages/ycast/__main__.py /opt/bin/ycast
    ~ # 
    ~ # sed -i -e 's,^#!.*python,#!/opt/bin/python,' /opt/bin/ycast 
    ~ # 
    ~ # chmod +x /opt/bin/ycast 
    ~ # 
    
    #!/bin/sh
    
    ENABLED=yes
    PROCS=ycast
    ARGS="-p 8888"
    PREARGS=""
    DESC="YCast"
    PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    . /opt/etc/init.d/rc.func
    
    ~ # 
    ~ # /opt/etc/init.d/S80ycast status
     Checking YCast...              dead. 
    ~ # 
    ~ # /opt/etc/init.d/S80ycast start
     Starting YCast...              done. 
    ~ # 
    ~ # /opt/etc/init.d/S80ycast status
     Checking YCast...              alive. 
    ~ # 
    ~ # /opt/etc/init.d/S80ycast stop
     Checking YCast...              alive. 
     Shutting down ycast...              done. 
    ~ # 
    ~ # /opt/etc/init.d/S80ycast status
     Checking YCast...              dead. 
    ~ # 
    ~ # /opt/etc/init.d/S80ycast start
     Starting YCast...              done. 
    ~ # 
    ~ # /opt/etc/init.d/S80ycast restart
     Shutting down ycast...              done. 
     Starting YCast...              done. 
    ~ # 

     

    • Thanks 1
  8. 19 минут назад, Jabber сказал:

    Кто может подсказать, чего не хватает?

    Скорее, много лишнего. В оригинале:

    ~ # 
    ~ # ls -al /opt/lib/libcrypto*
    -rw-r--r--    1 root     root       3502296 Mar 17 21:18 /opt/lib/libcrypto.so.3
    ~ # ls -al /opt/lib/libssl*
    -rw-r--r--    1 root     root        601480 Mar 17 21:18 /opt/lib/libssl.so.3
    ~ # 

    Переустанавливать всё, что зависит от (lib)openssl.

    • Thanks 1
  9. 14 часа назад, servo сказал:

    сам скрипт:

    Если ЭТО всё, ничего удивительного нет )))

    ~ # 
    ~ # /opt/etc/init.d/S81ycast start
    Service start
    ~ # 
    ~ # pgrep -alf ycast
    23142 python3 -m ycast -p 8888
    ~ # 
    ~ # /opt/etc/init.d/S81ycast stop
    Service stop
    ~ # 
    ~ # pgrep -alf ycast
    ~ # 

    функционал накручивайте сами

    #!/bin/sh
    
    PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin
    
    start() {
      python3 -m ycast -p 8888 > /dev/null 2>&1 &
    }
    
    stop() {
      kill $(pgrep -of ycast)
    }
    
    case "$1" in
    	start)
    		start && echo "Service start"
    	;;
    	stop)
    		stop && echo "Service stop"
    	;;
    	*)
    		echo "Usage: $0 {start|stop}"
    	;;
    esac
    

     

    • Thanks 1
  10. bump to 2023.3.4 (aarch64||mipsel) (прим. - отключить "zram")

    screen_2023-03-16_13:29:51-hass.png

    1 добавить "потеряху", иначе cryptography "прикажет долго жить"

    Скрытый текст
    #!/bin/sh
    
    # ossl-modules dir
    OSSL_DIR="/opt/lib/ossl-modules"
    # URL
    URL="$(grep 'HA' /opt/etc/opkg.conf | cut -d' ' -f3)"
    # create dir
    [ -d "$OSSL_DIR" ] || mkdir -p "$OSSL_DIR"
    # get lib
    [ -e "$OSSL_DIR/legacy.so" ] || wget -O "$OSSL_DIR"/legacy.so "$URL"/legacy.so 2>/dev/null
    

     

    2 снести pyroute2 и накатить новый (все вопросы (можно нецензурно) сюды (на кой порезал, на кой слепил обратно, ...))

    opkg list-installed | grep pyroute2 | cut -d' ' -f1 | xargs opkg remove --force-depends
    opkg install python3-pyroute2
    

    --- add ---

    п.1 не актуален, пакет "libopenssl" обновлён.

  11. В 05.03.2023 в 07:47, iN1KEL сказал:

    Апните пожалуйста до 2023.3 или выше :)

     

    3 часа назад, al12s сказал:

    АПните версию пожалуйста. Заранее спасибо.

    На данный момент, до полного завершения синхронизации с OpenWrt и выгрузки пакетов, сие не представляется возможным.

  12. В 22.02.2023 в 04:45, Eugene A сказал:

    Кто подскажет, как сохранить эти изменения? /etc - это не часть entware. После перезагрузки изменения слетают.

    Забацать скрипт автофикса. Типа:

    от простого...

    #!/bin/sh
    
    do_start() {
      if ! grep -q '^127.0.0.3 localhost' /etc/hosts; then
        echo '127.0.0.3 localhost' >> /etc/hosts
      fi
    }
    
    case "$1" in
        start)
            do_start
        ;;
        stop|restart|reload|status)
            return 0
        ;;
        *)
            printf "Usage: $0 {start}\n"
            exit 1
        ;;
    esac
    
    exit 0
    
    Скрытый текст
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost
    Usage: /opt/etc/init.d/S00fixhost {start}
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost start
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    127.0.0.3 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost start
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    127.0.0.3 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost restart
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    127.0.0.3 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost stop
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    127.0.0.3 localhost
    ~ # 
    ~ # sed -i '/127\.0\.0\.3.*/d' /var/hosts 
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost stop
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost restart
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    ~ # 
    ~ # /opt/etc/init.d/S00fixhost start
    ~ # 
    ~ # grep '^127' /etc/hosts
    127.0.0.1 localhost
    127.0.0.3 localhost
    ~ # 

     

    * 127.0.0.3 localhost - для демонстрации работы, заменить на нужные данные.

    ... до "навороченного" (!!! не готовое решение, а пример !!!)

    Скрытый текст

     

    #!/bin/sh
    
    ### colors
    ansi_std="\033[0;0m"
    ansi_red="\033[1;31m"
    ansi_green="\033[1;32m"
    ansi_yellow="\033[1;33m"
    ansi_cyan="\033[1;36m"
    ansi_white="\033[1;37m"
    
    ### columns
    COLUMNS="45"
    
    ACTION="$1"
    
    ENABLED=yes
    DESC="FixHostname"
    
    HOSTFILE="/etc/hosts"
    
    INHOST="192.168.1.2 $HOSTNAME"
    INNAS="192.168.3.4 my_nas"
    INPC="192.168.5.6 my_pc"
    INREPO="192.168.7.8 my_repo"
    
    do_check() {
      for fix in "$INHOST" "$INNAS" "$INPC" "$INREPO"; do
        if grep -q ^"${fix}" $HOSTFILE; then
          true
        else
          return 1
        fi
      done
    }
    
    do_start() {
      printf "$ansi_white %-${COLUMNS}s $ansi_std" "Starting $DESC ..."
    
      if [ "$ENABLED" != "yes" ]; then
        printf "$ansi_cyan %-${COLUMNS}s $ansi_std\n" "autorun disabled."
        return 0
      fi
    
      if [ "$ACTION" = "stop" ]; then
        printf "$ansi_yellow %-${COLUMNS}s $ansi_std\n" "$ACTION skipped."
        exit 0
      elif ! do_check; then
        for fix in "$INHOST" "$INNAS" "$INPC" "$INREPO"; do
          if ! grep -q ^"${fix}" $HOSTFILE; then
            echo "${fix}" >> $HOSTFILE
          fi
        done
    
        printf "$ansi_green %-${COLUMNS}s $ansi_std\n" "done."
        return 0
      else
        printf "$ansi_yellow %-${COLUMNS}s $ansi_std\n" "already fixed."
        return 0
      fi
    }
    
    do_enable() {
      printf "$ansi_white %-${COLUMNS}s $ansi_std" "Enabling autorun $DESC ..."
    
      if [ "$ENABLED" != "yes" ]; then
        sed -i 's,^ENABLED=no,ENABLED=yes,' "$0"
        printf "$ansi_green %-${COLUMNS}s $ansi_std\n" "done."
        return 0
      else
        printf "$ansi_yellow %-${COLUMNS}s $ansi_std\n" "already enabled."
        return 0
      fi
    }
    
    do_disable() {
      printf "$ansi_white %-${COLUMNS}s $ansi_std" "Disabling autorun $DESC ..."
    
      if [ "$ENABLED" = "yes" ]; then
        sed -i 's,^ENABLED=yes,ENABLED=no,' "$0"
        printf "$ansi_green %-${COLUMNS}s $ansi_std\n" "done."
        return 0
      else
        printf "$ansi_yellow %-${COLUMNS}s $ansi_std\n" "already disabled."
        return 0
      fi
    }
    
    case "$1" in
        start|stop|restart|reload|check|status)
            do_start
        ;;
        enable)
            do_enable
        ;;
        disable)
            do_disable
        ;;
        *)
            printf "$ansi_white %-${COLUMNS}s %-${COLUMNS}s $ansi_std\n" "Usage: $0" "{start}"
            exit 1
        ;;
    esac
    
    exit 0
    

     

     

    • Thanks 1
  13. ~ # ls -1 /opt/lib/opkg/info/*.control | wc -l
    751
    ~ #

    "ахтунг", 751 файл, откуда стока набралось...

    ~ # 
    ~ # cat /opt/etc/passwd-draft 
    root:$1$qIcnZlor$aUMGvS6VL7brlpSxLZO1y0:0:0:Root:/opt/root:/opt/bin/sh
    nobody:*:65534:65534:user "nobody"::/opt/bin/nologin
    ~ # 
    ~ # cat /opt/etc/group-draft 
    root:*:0:root
    nobody:*:65534:nobody
    ~ #

    юзверей и групп маловато будет для такого

    ~ # 
    ~ # time sh ./ug.sh 
    	Adding a new ntp group with an ID 123
    	Adding a new ntp user with an ID 123
    	Adding a new domoticz group with an ID 6144
    	Adding a new domoticz user with an ID 6144
    	Adding a new git group with an ID 382
    	Adding a new git user with an ID 382
    	Adding a new icecast group with an ID 87
    	Adding a new icecast user with an ID 87
    	Adding a new mosquitto group with an ID 200
    	Adding a new mosquitto user with an ID 200
    	The mosquitto group already exists
    	The mosquitto user already exists
    	Adding a new mpd group with an ID 65536
    	Adding a new mpd user with an ID 65536
    	Adding a new sshd group with an ID 22
    	Adding a new sshd user with an ID 22
    	Adding a new pulse group with an ID 51
    	Adding a new pulse user with an ID 51
    	Adding a new transmission group with an ID 224
    	Adding a new transmission user with an ID 224
    real	0m 1.22s
    user	0m 0.71s
    sys	0m 0.42s
    ~ # 

    шустро, однако.

    ~ # 
    ~ # cat /opt/etc/passwd-draft 
    root:$1$qIcnZlor$aUMGvS6VL7brlpSxLZO1y0:0:0:Root:/opt/root:/opt/bin/sh
    nobody:*:65534:65534:user "nobody"::/opt/bin/nologin
    ntp:x:123:123:user "ntp"::/opt/bin/false
    domoticz:x:6144:6144:user "domoticz"::/opt/bin/false
    git:x:382:382:user "git"::/opt/bin/false
    icecast:x:87:87:user "icecast"::/opt/bin/false
    mosquitto:x:200:200:user "mosquitto"::/opt/bin/false
    mpd:x:65536:65536:user "mpd"::/opt/bin/false
    sshd:x:22:22:user "sshd"::/opt/bin/false
    pulse:x:51:51:user "pulse"::/opt/bin/false
    transmission:x:224:224:user "transmission"::/opt/bin/false
    ~ # 
    ~ # cat /opt/etc/group-draft 
    root:*:0:root
    nobody:*:65534:nobody
    ntp:x:123:
    domoticz:x:6144:
    git:x:382:
    icecast:x:87:
    mosquitto:x:200:
    mpd:x:65536:
    sshd:x:22:
    pulse:x:51:
    transmission:x:224:
    ~ # 

    ну, вот, другое дело.

    и исчё разок:

    ~ # 
    ~ # time sh ./ug.sh 
    	The ntp group already exists
    	The ntp user already exists
    	The domoticz group already exists
    	The domoticz user already exists
    	The git group already exists
    	The git user already exists
    	The icecast group already exists
    	The icecast user already exists
    	The mosquitto group already exists
    	The mosquitto user already exists
    	The mosquitto group already exists
    	The mosquitto user already exists
    	The mpd group already exists
    	The mpd user already exists
    	The sshd group already exists
    	The sshd user already exists
    	The pulse group already exists
    	The pulse user already exists
    	The transmission group already exists
    	The transmission user already exists
    real	0m 1.08s
    user	0m 0.65s
    sys	0m 0.36s
    ~ # 

    больше не хотить...

    велокостыль:

    Скрытый текст

    ~ # cat ug.sh

    #!/bin/sh
    
    ### USERID:=${user-name}=${user-id}:${group-name}=${group-id}
    ### /opt/etc/group: ${group-name}:(groupe-password):${groupe-id}:${includes}
    ### /opt/etc/passwd: ${user-name}:(user-password):${user-id}:${groupe-id}:${user-description}:${user-home}:${user-shell}
    
    ### colors ###
    ansi_std="\033[0m"
    ansi_white="\033[1;37m"
    
    ### paths to files ###
    FILE_GROUP="/opt/etc/group"
    FILE_PASSWD="/opt/etc/passwd"
    
    grep '^Require-User' /opt/lib/opkg/info/*.control | cut -d' ' -f2 | while IFS= read -r line
      do
        ### group name
        grpname=$(echo "${line}" | cut -d: -f2 | cut -d= -f1)
        ### group id
        grpid=$(echo "${line}" | cut -d: -f2 | cut -d= -f2)
        ### user name
        usrname=$(echo "${line}" | cut -d: -f1 | cut -d= -f1)
        ### user id
        usrid=$(echo "${line}" | cut -d: -f1 | cut -d= -f2)
        ### if ${group-id} empty
        if [ "$grpname" = "$grpid" ]; then
            gids=$(cut -d: -f3 $FILE_GROUP)
            g_id=65536
            while echo "$gids" | grep -q $g_id; do
                g_id=$((g_id + 1))
            done
            grpid=$g_id
        fi
        ### if ${user-id} empty
        if [ "$usrname" = "$usrid" ]; then
            uids=$(cut -d: -f3 $FILE_PASSWD)
            u_id=65536
            while echo "$uids" | grep -q $u_id; do
                u_id=$((u_id + 1))
            done
            usrid=$u_id
        fi
        ### check/add group
        if grep -q "$grpname" $FILE_GROUP; then
            printf "\tThe $ansi_white%s$ansi_std group already exists\n" "$grpname"
        else
            printf "\tAdding a new $ansi_white%s$ansi_std group with an ID $ansi_white%s$ansi_std\n" "$grpname" "$grpid"
            echo "$grpname:x:$grpid:" >> $FILE_GROUP
        fi
        ### check/add user
        if grep -q "$usrname" $FILE_PASSWD; then
            printf "\tThe $ansi_white%s$ansi_std user already exists\n" "$usrname"
        else
            printf "\tAdding a new $ansi_white%s$ansi_std user with an ID $ansi_white%s$ansi_std\n" "$usrname" "$usrid"
            echo "$usrname:x:$usrid:$grpid:user \"$usrname\"::/opt/bin/false" >> $FILE_PASSWD
        fi
    done
    

     

     

  14. 13 часа назад, Totoro сказал:

    но ему нужна kafka,

    https://github.com/cloudflare/goflow#run

    Цитата

    Disable Kafka sending -kafka=false.

    Не?

    Скрытый текст
    # HELP flow_decoder_count Decoder processed count.
    # TYPE flow_decoder_count counter
    flow_decoder_count{name="NetFlow",worker="0"} 3347
    # HELP flow_process_nf_count NetFlows processed.
    # TYPE flow_process_nf_count counter
    flow_process_nf_count{router="127.0.0.1",version="9"} 3347
    # HELP flow_process_nf_delay_summary_seconds NetFlows time difference between time of flow and processing.
    # TYPE flow_process_nf_delay_summary_seconds summary
    flow_process_nf_delay_summary_seconds{router="127.0.0.1",version="9",quantile="0.5"} 31
    flow_process_nf_delay_summary_seconds{router="127.0.0.1",version="9",quantile="0.9"} 41
    flow_process_nf_delay_summary_seconds{router="127.0.0.1",version="9",quantile="0.99"} 52
    flow_process_nf_delay_summary_seconds_sum{router="127.0.0.1",version="9"} 1.7794e+06
    flow_process_nf_delay_summary_seconds_count{router="127.0.0.1",version="9"} 58287
    # HELP flow_process_nf_errors_count NetFlows processed errors.
    # TYPE flow_process_nf_errors_count counter
    flow_process_nf_errors_count{error="template_not_found",router="127.0.0.1"} 98
    # HELP flow_process_nf_flowset_records_sum NetFlows FlowSets sum of records.
    # TYPE flow_process_nf_flowset_records_sum counter
    flow_process_nf_flowset_records_sum{router="127.0.0.1",type="DataFlowSet",version="9"} 58287
    flow_process_nf_flowset_records_sum{router="127.0.0.1",type="OptionsDataFlowSet",version="9"} 8013
    flow_process_nf_flowset_records_sum{router="127.0.0.1",type="OptionsTemplateFlowSet",version="9"} 1367
    # HELP flow_process_nf_flowset_sum NetFlows FlowSets sum.
    # TYPE flow_process_nf_flowset_sum counter
    flow_process_nf_flowset_sum{router="127.0.0.1",type="DataFlowSet",version="9"} 47295
    flow_process_nf_flowset_sum{router="127.0.0.1",type="OptionsDataFlowSet",version="9"} 1616
    flow_process_nf_flowset_sum{router="127.0.0.1",type="OptionsTemplateFlowSet",version="9"} 348
    flow_process_nf_flowset_sum{router="127.0.0.1",type="TemplateFlowSet",version="9"} 1019
    # HELP flow_process_nf_templates_count NetFlows Template count.
    # TYPE flow_process_nf_templates_count counter
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="285",type="options_template",version="9"} 99
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="286",type="template",version="9"} 160
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="288",type="template",version="9"} 159
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="289",type="template",version="9"} 161
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="290",type="template",version="9"} 160
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="291",type="options_template",version="9"} 151
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="292",type="template",version="9"} 150
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="293",type="template",version="9"} 150
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="294",type="options_template",version="9"} 98
    flow_process_nf_templates_count{obs_domain_id="0",router="127.0.0.1",template_id="295",type="template",version="9"} 88
    # HELP flow_summary_decoding_time_us Decoding time summary.
    ...

    напр.,

    screen_2023-02-05_12:42:17-prom-gofl.png

    В стартовых скриптах оно есть...

    ~ # grep ^ARG /opt/etc/init.d/S99goflow 
    ARGS="-kafka=false -nfl=false -sflow=false"
    ~ #

     

    • Thanks 1
    • Upvote 1
×
×
  • Create New...