diff options
author | msojocs | 2022-04-12 23:06:57 +0800 |
---|---|---|
committer | msojocs | 2022-04-12 23:06:57 +0800 |
commit | 6415cbfe1239f0d4e842cdca5a464dfb68cdb630 (patch) | |
tree | cf4018b0534d9e066d943890fe395c3df23950c2 | |
parent | 8de184d8992f392fb52a403f0b0c52bafe8e92f8 (diff) | |
download | aur-6415cbfe1239f0d4e842cdca5a464dfb68cdb630.tar.gz |
fix: 命令行启动 & cli
-rw-r--r-- | PKGBUILD | 6 | ||||
-rw-r--r-- | wechat-devtools | 8 | ||||
-rw-r--r-- | wechat-devtools-cli | 17 |
3 files changed, 30 insertions, 1 deletions
@@ -36,6 +36,7 @@ source=("nwjs-v${_nwjs_ver}.tar.gz::https://npm.taobao.org/mirrors/nwjs/v${_nwjs "wechat-devtools.desktop" "logo.svg" "wechat-devtools" + "wechat-devtools-cli" "fix-cli.sh" "fix-menu.sh" "fix-core.sh" @@ -58,6 +59,7 @@ md5sums=(ac7680788544c457daee11aaf69798fe # nwjs "SKIP" "SKIP" "SKIP" + "SKIP" "SKIP") options=('!strip') @@ -121,6 +123,10 @@ package() { cd nwjs && ln -s node node.exe install -Dm755 "${srcdir}/wechat-devtools" "${pkgdir}${_install_dir}/bin/wechat-devtools" + install -Dm755 "${srcdir}/wechat-devtools-cli" "${pkgdir}${_install_dir}/bin/wechat-devtools-cli" install -Dm644 "${srcdir}/wechat-devtools.desktop" "${pkgdir}/usr/share/applications/wechat-devtools.desktop" install -Dm644 "${srcdir}/logo.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/wechat-devtools.svg" + mkdir -p "${pkgdir}/usr/bin" + ln -s "${_install_dir}/bin/wechat-devtools" "${pkgdir}/usr/bin/wechat-devtools" + ln -s "${_install_dir}/bin/wechat-devtools-cli" "${pkgdir}/usr/bin/wechat-devtools-cli" } diff --git a/wechat-devtools b/wechat-devtools index 32bf9a910a91..7944a8d5bce6 100644 --- a/wechat-devtools +++ b/wechat-devtools @@ -1,6 +1,12 @@ #!/bin/bash -root_dir=$(cd `dirname $0`/.. && pwd -P) +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )" # 数据目录处理 if [ -z $XDG_CONFIG_HOME ];then diff --git a/wechat-devtools-cli b/wechat-devtools-cli new file mode 100644 index 000000000000..358007822327 --- /dev/null +++ b/wechat-devtools-cli @@ -0,0 +1,17 @@ +#!/bin/bash + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )" + +cd $root_dir + +export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs" +export APPDATA="$root_dir/nwjs" +export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH" + +node $root_dir/package.nw/js/common/cli/index.js "$@"
\ No newline at end of file |