#!/bin/sh REPO="KeenKit" SCRIPT="keenkit.sh" TMP_DIR="/tmp" OPT_DIR="/opt" BRANCH="main" print_message() { local message="$1" local color="${2:-$NC}" local border=$(printf '%0.s-' $(seq 1 $((${#message} + 2)))) printf "${color}\n+${border}+\n| ${message} |\n+${border}+\n${NC}\n" } packages_checker() { local missing="" for pkg in "$@"; do if ! opkg list-installed | grep -q "^$pkg"; then missing="$missing $pkg" fi done if [ -n "$missing" ]; then print_message "Устанавливаем:$missing" opkg update >/dev/null 2>&1 opkg install $missing echo "" fi } packages_checker curl tar findutils jq libcurl curl -L -s "https://raw.githubusercontent.com/spatiumstas/$REPO/$BRANCH/$SCRIPT" --output $TMP_DIR/$SCRIPT mv "$TMP_DIR/$SCRIPT" "$OPT_DIR/$SCRIPT" chmod +x $OPT_DIR/$SCRIPT cd $OPT_DIR/bin ln -sf $OPT_DIR/$SCRIPT $OPT_DIR/bin/keenkit exec $OPT_DIR/$SCRIPT