瀏覽代碼

Update blocky-install.sh

code refactoring
tteckster 1 年之前
父節點
當前提交
2f82410083
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      install/blocky-install.sh

+ 7 - 7
install/blocky-install.sh

@@ -20,13 +20,13 @@ $STD apt-get install -y mc
 msg_ok "Installed Dependencies"
 
 msg_info "Installing Blocky"
-systemctl stop systemd-resolved
-$STD systemctl disable systemd-resolved.service
-RELEASE=0.20 #$(curl -s https://api.github.com/repos/0xERR0R/blocky/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
-wget -q https://github.com/0xERR0R/blocky/releases/download/v$RELEASE/blocky_${RELEASE}_Linux_x86_64.tar.gz
-mkdir -p /opt/blocky
-tar -xf blocky_${RELEASE}_Linux_x86_64.tar.gz -C /opt/blocky
-rm -rf blocky_${RELEASE}_Linux_x86_64.tar.gz
+if systemctl is-active systemd-resolved > /dev/null 2>&1; then
+  systemctl disable -q --now systemd-resolved
+fi
+mkdir /opt/blocky
+RELEASE=$(curl -s https://api.github.com/repos/0xERR0R/blocky/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+wget -qO- https://github.com/0xERR0R/blocky/releases/download/v${RELEASE}/blocky_v${RELEASE}_Linux_x86_64.tar.gz | tar -xzf - -C /opt/blocky/
+
 cat <<EOF >/opt/blocky/config.yml
 upstream:
   # these external DNS resolvers will be used. Blocky picks 2 random resolvers from the list for each query