├── README.md ├── install_ddnsto.sh └── install_ddnsto_linux.sh /README.md: -------------------------------------------------------------------------------- 1 | # ddnsto 在 openwrt 的一键安装脚本 2 | 3 | ## 旧的安装方式如下 4 | 5 | - 可以直接在软路由ttyd执行,复制👇👇👇 6 | - ```sh -c "$(curl -sSL http://fw.koolcenter.com/binary/ddnsto/openwrt/install_ddnsto.sh)"``` 7 | - 然后到ttyd终端下回车后进度结束。👇 8 | - 刷新一下就出现在服务里了。如果还没明白,可以[**看视频**](https://www.bilibili.com/video/BV1mo4y197jK)如何安装就行 9 | - 如果在过程中遇到安装失败,可以执行备用命令安装👇 10 | - 备用命令 ```wget --no-check-certificate https://raw.githubusercontent.com/linkease/ddnsto_all_in_one_script/master/install_ddnsto.sh && sh install_ddnsto.sh``` 11 | 12 | ## 新的安装方式如下 13 | 14 | ### via curl 15 | ``` 16 | sh -c "$(curl -sSL http://fw.koolcenter.com/binary/ddnsto/openwrt/install_ddnsto.sh)" 17 | ``` 18 | ### via wget 19 | ``` 20 | sh -c "$(wget --no-check-certificate -qO- http://fw.koolcenter.com/binary/ddnsto/openwrt/install_ddnsto.sh)" 21 | ``` 22 | #### Or 23 | ``` 24 | cd /tmp; wget --no-check-certificate http://fw.koolcenter.com/binary/ddnsto/openwrt/install_ddnsto.sh; sh ./install_ddnsto.sh 25 | ``` 26 | # 使用方法教程 27 | - ddnsto官方教程:[**👉点击链接👈**](https://doc.linkease.com/zh/guide/ddnsto/koolshare_merlin.html) 28 | - 哔哩哔哩教程:[**👉点击链接👈**](https://www.bilibili.com/video/BV1E5411K7MB/) 29 | - YouTube教程:[**👉点击链接👈**](https://www.youtube.com/watch?v=nwf__oD9Z_8) 30 | -------------------------------------------------------------------------------- /install_ddnsto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | version="1.0" 4 | APP_URL='http://fw.koolcenter.com/binary/ddnsto/openwrt' 5 | app_arm='ddnsto_arm.ipk' 6 | app_aarch64='ddnsto_aarch64.ipk' 7 | app_mips='ddnsto_mipsel.ipk' 8 | app_x86='ddnsto_x86_64.ipk' 9 | app_binary='ddnsto.ipk' 10 | app_ui='luci-app-ddnsto.ipk' 11 | app_lng='luci-i18n-ddnsto-zh-cn.ipk' 12 | 13 | setup_color() { 14 | # Only use colors if connected to a terminal 15 | if [ -t 1 ]; then 16 | RED=$(printf '\033[31m') 17 | GREEN=$(printf '\033[32m') 18 | YELLOW=$(printf '\033[33m') 19 | BLUE=$(printf '\033[34m') 20 | BOLD=$(printf '\033[1m') 21 | RESET=$(printf '\033[m') 22 | else 23 | RED="" 24 | GREEN="" 25 | YELLOW="" 26 | BLUE="" 27 | BOLD="" 28 | RESET="" 29 | fi 30 | } 31 | setup_color 32 | command_exists() { 33 | command -v "$@" >/dev/null 2>&1 34 | } 35 | error() { 36 | echo ${RED}"Error: $@"${RESET} >&2 37 | } 38 | 39 | Download_Files(){ 40 | local URL=$1 41 | local FileName=$2 42 | if command_exists curl; then 43 | curl -sSLk ${URL} -o ${FileName} 44 | elif command_exists wget; then 45 | wget -c --no-check-certificate ${URL} -O ${FileName} 46 | fi 47 | } 48 | 49 | remove_deprecated(){ 50 | if echo `cat /etc/config/ddnsto` | grep -Eqi 'global'; then 51 | rm /etc/config/ddnsto 52 | fi 53 | } 54 | 55 | clean_app(){ 56 | rm -f /tmp/${app_binary} /tmp/${app_ui} /tmp/${app_lng} 57 | } 58 | 59 | fork_ugprade() { 60 | 61 | cat <<\EOF >/tmp/.ddnsto-upgrade.sh 62 | #!/bin/sh 63 | 64 | app_binary='ddnsto.ipk' 65 | app_ui='luci-app-ddnsto.ipk' 66 | app_lng='luci-i18n-ddnsto-zh-cn.ipk' 67 | opkg remove app-meta-ddnsto luci-i18n-ddnsto-zh-cn luci-app-ddnsto ddnsto 68 | opkg install /tmp/${app_binary} 69 | opkg install /tmp/${app_ui} 70 | opkg install /tmp/${app_lng} 71 | rm -f /tmp/${app_binary} /tmp/${app_ui} /tmp/${app_lng} 72 | EOF 73 | 74 | chmod 755 /tmp/.ddnsto-upgrade.sh 75 | 76 | } 77 | 78 | command_exists opkg || { 79 | error "The program only supports Openwrt." 80 | clean_app 81 | exit 1 82 | } 83 | 84 | opkg install luci-compat || true 85 | 86 | if echo `uname -m` | grep -Eqi 'x86_64'; then 87 | arch='x86_64' 88 | ( set -x; Download_Files ${APP_URL}/${app_x86} /tmp/${app_binary}; 89 | Download_Files ${APP_URL}/${app_ui} /tmp/${app_ui}; 90 | Download_Files ${APP_URL}/${app_lng} /tmp/${app_lng}; ) 91 | elif echo `uname -m` | grep -Eqi 'arm'; then 92 | arch='arm' 93 | ( set -x; Download_Files ${APP_URL}/${app_arm} /tmp/${app_binary}; 94 | Download_Files ${APP_URL}/${app_ui} /tmp/${app_ui}; 95 | Download_Files ${APP_URL}/${app_lng} /tmp/${app_lng}; ) 96 | elif echo `uname -m` | grep -Eqi 'aarch64'; then 97 | arch='aarch64' 98 | ( set -x; Download_Files ${APP_URL}/${app_aarch64} /tmp/${app_binary}; 99 | Download_Files ${APP_URL}/${app_ui} /tmp/${app_ui}; 100 | Download_Files ${APP_URL}/${app_lng} /tmp/${app_lng}; ) 101 | elif echo `uname -m` | grep -Eqi 'mipsel|mips'; then 102 | arch='mips' 103 | ( set -x; Download_Files ${APP_URL}/${app_mips} /tmp/${app_binary}; 104 | Download_Files ${APP_URL}/${app_ui} /tmp/${app_ui}; 105 | Download_Files ${APP_URL}/${app_lng} /tmp/${app_lng}; ) 106 | else 107 | error "The program only supports Openwrt." 108 | exit 1 109 | fi 110 | 111 | rm -f /tmp/.ddnsto-upgrade.pid 112 | remove_deprecated 113 | fork_ugprade 114 | 115 | if which start-stop-daemon >/dev/null; then 116 | echo "fork to install, version is:" 117 | start-stop-daemon -S -b -q -m -x /tmp/.ddnsto-upgrade.sh -p /tmp/.ddnsto-upgrade.pid 118 | sleep 3 119 | if [ -f /tmp/.ddnsto-upgrade.pid ]; then 120 | 121 | PID=`cat /tmp/.ddnsto-upgrade.pid` 122 | if test -d /proc/"${PID}"/; then 123 | echo "waiting to finish" 124 | sleep 5 125 | fi 126 | 127 | fi 128 | else 129 | echo "install, version is:" 130 | /tmp/.ddnsto-upgrade.sh 131 | fi 132 | 133 | ddnsto -v 134 | RET=$? 135 | if [ "${RET}" = "1" ]; then 136 | 137 | printf "$GREEN" 138 | cat <<-'EOF' 139 | ____ ____ _ _ ____ _____ ___ 140 | | _ \| _ \| \ | / ___|_ _/ _ \ 141 | | | | | | | | \| \___ \ | || | | | 142 | | |_| | |_| | |\ |___) || || |_| | 143 | |____/|____/|_| \_|____/ |_| \___/ ....is now installed! 144 | 145 | 146 | 感谢使用 DDNSTO,请登录 https://www.ddnsto.com 获取 token 填入插件 147 | 148 | EOF 149 | printf "$RESET" 150 | 151 | else 152 | error "cannot install ddnsto, ret=${RET}" 153 | fi 154 | 155 | -------------------------------------------------------------------------------- /install_ddnsto_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | version="1.0" 4 | APP_URL='https://fw.koolcenter.com/binary/ddnsto/linux' 5 | app_aarch64='ddnsto.arm64' 6 | app_x86='ddnsto.amd64' 7 | tmp_path='/tmp/ddnsto' 8 | bin_path='/usr/local/bin/ddnsto' 9 | 10 | echo "get your token from https://www.ddnsto.com" 11 | read -p "please enter your token:" token 12 | command_exists() { 13 | command -v "$@" >/dev/null 2>&1 14 | } 15 | error() { 16 | echo ${RED}"Error: $@"${RESET} >&2 17 | } 18 | 19 | CURR_UID=`id -u` 20 | SUDO= 21 | 22 | if [ "${CURR_UID}" = "0" ] ; then 23 | echo "run as root" 24 | else 25 | echo "use sudo" 26 | SUDO=sudo 27 | fi 28 | 29 | Download_Files(){ 30 | local URL=$1 31 | local FileName=$2 32 | if command_exists curl; then 33 | curl -sSLk ${URL} -o ${FileName} 34 | elif command_exists wget; then 35 | wget -c --no-check-certificate ${URL} -O ${FileName} 36 | fi 37 | } 38 | 39 | if [ -f "/usr/local/bin/ddnsto" ];then 40 | echo `ddnsto exist` 41 | ${SUDO} ddnsto stop 42 | fi 43 | 44 | if echo `uname -m` | grep -Eqi 'x86_64'; then 45 | arch='x86_64' 46 | ( set -x; Download_Files ${APP_URL}/${app_x86} $tmp_path; ${SUDO} mv $tmp_path $bin_path) 47 | elif echo `uname -m` | grep -Eqi 'aarch64'; then 48 | arch='aarch64' 49 | ( set -x; Download_Files ${APP_URL}/${app_aarch64} $tmp_path; ${SUDO} mv $tmp_path $bin_path) 50 | else 51 | error "The program only supports x86_64 & aarch64." 52 | exit 1 53 | fi 54 | 55 | 56 | ${SUDO} chmod +x $bin_path 57 | ${SUDO} ddnsto -u $token -daemon 58 | 59 | echo "command to stop ddnsto service: systemctl stop com.linkease.ddnstoshell" 60 | 61 | --------------------------------------------------------------------------------