poesty 1 ano atrás
commit
e5c4d9c99b

+ 41 - 0
install/get_go.sh

@@ -0,0 +1,41 @@
+#! /bin/bash
+
+# [get_golang.sh](https://gist.github.com/n8henrie/1043443463a4a511acf98aaa4f8f0f69)
+# Download latest Golang release for AMD64
+# https://dl.google.com/go/go1.10.linux-amd64.tar.gz
+
+set -euf -o pipefail
+# Install pre-reqs
+sudo apt-get install python3 git -y
+o=$(python3 -c $'import os\nprint(os.get_blocking(0))\nos.set_blocking(0, True)')
+
+#Download Latest Go
+LATEST="$(curl -s https://go.dev/VERSION?m=text)"
+DL_PKG="$LATEST.linux-amd64.tar.gz"
+DL_URL="https://golang.org/dl/$DL_PKG"
+echo "Finding latest version of Go for AMD64..."
+echo "Downloading latest Go for AMD64: ${LATEST}"
+wget --quiet --continue --show-progress "${DL_URL}"
+unset url
+unset GOURLREGEX
+
+# Remove Old Go
+sudo rm -rf /usr/local/go
+
+# Install new Go
+sudo tar -C /usr/local -xzf "${LATEST}".linux-amd64.tar.gz
+echo "Create the skeleton for your local users go directory"
+mkdir -p ~/go/{bin,pkg,src}
+echo "Setting up GOPATH"
+echo "export GOPATH=~/go" >> ~/.profile && source ~/.profile
+echo "Setting PATH to include golang binaries"
+echo "export PATH='$PATH':/usr/local/go/bin:$GOPATH/bin" >> ~/.profile && source ~/.profile
+#echo "Installing dep for dependency management"
+#go get -u github.com/golang/dep/cmd/dep
+
+# Remove Download
+rm "${LATEST}".linux-amd64.tar.gz
+
+# Print Go Version
+/usr/local/go/bin/go version
+python3 -c $'import os\nos.set_blocking(0, '$o')'

+ 9 - 0
update/update_librex.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+cd /root/librex
+git fetch
+if [ -n "$(git diff @ @{u})" ]; then
+  git pull
+  lftp -c "set sftp:auto-confirm yes; open sftp://[REDACTED]; mirror -Rev ./ [REMOTE]/ --only-newer --parallel=10 -X .htaccess -X config.php -X opensearch.xml -X robots.txt"
+else
+  echo "Up-to-date"
+fi

+ 20 - 0
update/update_mdbook.sh

@@ -0,0 +1,20 @@
+#!/bin/bash
+cd /root/BookStack2Site/ && rm -r book-test/src book-test/book
+BookStackEndpoint=""
+BookStackAPITokenID=
+BookStackAPITokenSecret=
+MdBookSite=""
+bin/bookstack2site --bookstack-url=${BookStackEndpoint} --token-id=${BookStackAPITokenID} --token-secret=${BookStackAPITokenSecret} --download-location="./book-test/src"
+# notice: better change the name of markdown files, so the path in URL would not be too ugly
+# convert markup to mdbook-admonish
+# success label is not supported
+# mdbook-regex is also suggested
+cd book-test 
+find . -name "*.md" -exec sed -i 's/<p class="callout info">\(.*\)<\/p>/```admonish info\n\1\n```/g' {} \;
+find . -name "*.md" -exec sed -i 's/<p class="callout warning">\(.*\)<\/p>/```admonish warning\n\1\n```/g' {} \;
+find . -name "*.md" -exec sed -i 's/<p class="callout danger">\(.*\)<\/p>/```admonish danger\n\1\n```/g' {} \;
+# build static pages
+../bin/mdbook build
+../bin/mdbook-sitemap-generator -d ${MdBookSite} -o book/sitemap.xml
+# upload
+# lftp stuff

+ 8 - 0
update/update_qiandao.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+dic="/root" #配置文件目录
+docker stop $(docker ps -a -q -f name=qiandao)
+docker rm $(docker ps -a -q -f name=qiandao)
+docker rmi $(docker images -a -q a76yyyy/qiandao)
+docker pull a76yyyy/qiandao
+docker run -d --name qiandao -p 8923:80 -v $dic/qiandao/config:/usr/src/app/config a76yyyy/qiandao #可改命令
+#适配修改版 未经测试

+ 6 - 0
update/update_soapbox.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+cd /root
+curl -L https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/develop/download\?job\=build-production -o soapbox.zip
+unzip soapbox.zip
+lftp -c "set sftp:auto-confirm yes; open sftp://[REDACTED]; mirror -Rev static/ [REMOTE]/ --only-newer --parallel=10 -X .htaccess -X favicon.ico"
+rm -r static soapbox.zip