H7-TOOL PC AUR 包
原帖 H7-TOOL PC AUR 包 http://www.armbbs.cn/forum.php?mod=viewthread&tid=107327
由于迟迟不出 H7-TOOL PC Linux 版本写了个 PKGBUILD 将 H7-TOOL PC 打包到 AUR 仓库了
有用 Arch 系得群友可以帮忙验证一下
为了便于区别将 h7toolpc-bin 改名成 h7tool-wine
https://aur.archlinux.org/packages/h7toolpc-wine/
PKGBUILD
# Maintainer: taotieren <admin@taotieren.com>
pkgname=h7toolpc-wine
pkgver=2.0.5
pkgrel=1
pkgdesc="Wine H7-TOOL 的 PC 上位机,支持串口、CAN、示波器、CMSIS-DAP、DS18B20、RTT Viewer、脱机烧录等"
arch=('x86_64')
url="http://www.armbbs.cn/forum.php?mod=viewthread&tid=95468"
license=('unknow')
provides=(\({pkgname}</span><span class="token punctuation">)</span> <span class="token assign-left variable">conflicts</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token variable">\){pkgname} \({pkgname<span class="token operator">%</span>-wine}</span><span class="token punctuation">)</span> <span class="token assign-left variable">replaces</span><span class="token operator">=</span><span class="token punctuation">(</span>h7toolpc-bin<span class="token punctuation">)</span> <span class="token assign-left variable">depends</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token string">'wine'</span> <span class="token string">'wqy-zenhei'</span><span class="token punctuation">)</span> <span class="token assign-left variable">optdepends</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token string">"wine-mono-gecko-version-fix: Fix the version numbers of wine-mono and wine-gecko files to solve the dialog box that pops up when starting wine."</span><span class="token punctuation">)</span> <span class="token assign-left variable">makedepends</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token string">'unarchiver'</span><span class="token punctuation">)</span> <span class="token assign-left variable">backup</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token assign-left variable">options</span><span class="token operator">=</span><span class="token punctuation">(</span><span class="token string">'!strip'</span><span class="token punctuation">)</span> <span class="token assign-left variable">install</span><span class="token operator">=</span><span class="token variable">\){pkgname}.install
source=("\({pkgname<span class="token operator">/</span>pc-wine<span class="token operator">/</span>PC_release}</span>.zip::http://www.armfly.com/download/H7-TOOL/<span class="token variable">\){pkgname/pc-wine/PC_release}(V\({pkgver}</span>).zip"</span> <span class="token string">"icons.tar.gz"</span> <span class="token string">"<span class="token variable">\){pkgname}.install")
sha256sums=('13a02cb749bc6e5c69986ee231e0647ed829c5d5247bd77d4509a91093f7e121'
'6823224b5699dc17c41efdcbc8465554f007cb62cadea0aad9b67c08c5698142'
'078a64b4818c65daabe24ad31ead1912ee564b15da79084fa1c7d1a004f30cef')
noextract=("${pkgname/pc-wine/PC_release}.zip"
"icons.tar.gz")prepare() {
unar -e GBK "\({srcdir}</span>/<span class="token variable">\){pkgname/pc-wine/PC_release}.zip"
}package() {
export LC_CTYPE="zh_CN.UTF-8"<span class="token assign-left variable">armfly</span><span class="token operator">=</span><span class="token string">"opt/armfly"</span> <span class="token function">install</span> -dm0755 <span class="token string">"<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>"</span> <span class="token function">cp</span> -ra <span class="token variable">${srcdir}</span>/<span class="token variable">${pkgname<span class="token operator">/</span>pc-wine<span class="token operator">/</span>PC_release}</span>/* <span class="token string">"<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>"</span> <span class="token function">find</span> <span class="token string">"<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>"</span> -type f -exec <span class="token function">chmod</span> <span class="token number">644</span> <span class="token string">"{}"</span> <span class="token punctuation">\</span><span class="token punctuation">;</span> <span class="token function">find</span> <span class="token string">"<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>"</span> -type d -exec <span class="token function">chmod</span> <span class="token number">755</span> <span class="token string">"{}"</span> <span class="token punctuation">\</span><span class="token punctuation">;</span> <span class="token assign-left variable">_ftname</span><span class="token operator">=</span><span class="token string">"wqy-zenhei.ttc"</span> <span class="token function">install</span> -Dm0644 /dev/stdin <span class="token string">"<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/regpatch.reg"</span> <span class="token operator"><<</span> <span class="token string">EOF
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="\({_ftname}</span>" "Microsoft Sans Serif"="<span class="token variable">\){_ftname}"
"MS Sans Serif"="\({_ftname}</span>" "Tahoma"="<span class="token variable">\){_ftname}"
"Tahoma Bold"="\({_ftname}</span>" "SimSun"="<span class="token variable">\){_ftname}"
"Arial"="\({_ftname}</span>" "Arial Black"="<span class="token variable">\){_ftname}"
"Lucida Sans Unicode"=str(7):"\({_ftname}</span>" "Microsoft Sans Serif"=str(7):"<span class="token variable">\){_ftname}"
"Tahoma"=str(7):"\({_ftname}</span>" "Lucida Sans Unicode"="<span class="token variable">\){_ftname}"
"Microsoft Sans Serif"="\({_ftname}</span>" "Microsoft YaHei"="<span class="token variable">\){_ftname}"
"微软雅黑"="\({_ftname}</span>" "宋体"="<span class="token variable">\){_ftname}"
"新細明體"="\({_ftname}</span>" "DFKai-SB"="<span class="token variable">\){_ftname}"
"FangSong"="\({_ftname}</span>" "KaiTi"="<span class="token variable">\){_ftname}"
"Microsoft JhengHei"="\({_ftname}</span>" "Microsoft YaHei"="<span class="token variable">\){_ftname}"
"MingLiU"="\({_ftname}</span>" "NSimSun"="<span class="token variable">\){_ftname}"
"PMingLiU"="\({_ftname}</span>" "SimHei"="<span class="token variable">\){_ftname}"
"SimKai"="\({_ftname}</span>" "SimSun"="<span class="token variable">\){_ftname}"[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideAntiAliasWithCore"="N"
"ClientSideAntiAliasWithRender"="N"
"ClientSideWithRender"="N"[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
"FontSmoothingOrientation"=dword:00000001[HKEY_LOCAL_MACHINE\Software\Wine\Ports]
"COM1"="/dev/ttyUSB0"
"COM2"="/dev/ttyUSB1"
"COM3"="/dev/ttyUSB2"
"COM4"="/dev/ttyUSB3"
"COM5"="/dev/ttyUSB4"
"COM6"="/dev/ttyUSB5"
"COM7"="/dev/ttyACM0"
EOF<span class="token function">install</span> -Dm0755 /dev/stdin <span class="token string">"<span class="token variable">${pkgdir}</span>/usr/bin/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>"</span> <span class="token operator"><<</span> <span class="token string">EOF
!/bin/bash
export WINEARCH=win32 WINEPREFIX="\(HOME</span>/.<span class="token variable">\){pkgname%-wine}/wine"
if [ ! -d "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine} ] ; then
mkdir -p "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/wine || exit 1cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/app.ini "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Backup "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Readback "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/ini "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/log "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/*.lua "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/regpatch.reg "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/wine || exit 1 ln -s /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/<span class="token variable">${pkgname<span class="token operator">/</span>pc-wine<span class="token operator">/</span>PC}</span>.exe "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 ln -s -T /<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Driver "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Driver || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/EMMC "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/EMMC || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Help "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Help || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/USBBus "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/USBBus || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/ChangeLog.txt "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/ChangeLog.txt || exit 1
fi
if [ ! -f "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/fontok ] ; then
touch "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/fontok || exit 1
regedit "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/wine/regpatch.reg && wineserver -k
wine "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/Driver/WinUSB/zadig-2.5.exe
fiwine "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/\({pkgname<span class="token operator">%</span>-wine}</span> -opengl "<span class="token variable">\)@"
EOF<span class="token function">install</span> -Dm0644 /dev/stdin <span class="token string">"<span class="token variable">${pkgdir}</span>/usr/share/applications/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>.desktop"</span> <span class="token operator"><<</span> <span class="token string">EOF
[Desktop Entry]
Name=\({pkgname<span class="token operator">%</span>-wine}</span> Name[zh_CN]=<span class="token variable">\){pkgname%-wine}
Comment=${pkgdesc}MimeType=application/x-${pkgname%-wine};
Exec=\({pkgname<span class="token operator">%</span>-wine}</span> %f Type=Application Categories=Development;Tool; Terminal=false Icon=<span class="token variable">\){pkgname%-wine}.png
Version=${pkgver}
EOF<span class="token function">install</span> -Dm0755 /dev/stdin <span class="token string">"<span class="token variable">${pkgdir}</span>/usr/bin/<span class="token variable">${pkgname<span class="token operator">/</span>-wine<span class="token operator">/</span>-old}</span>"</span> <span class="token operator"><<</span> <span class="token string">EOF
!/bin/bash
export WINEARCH=win32 WINEPREFIX="\(HOME</span>/.<span class="token variable">\){pkgname%-wine}/wine"
if [ ! -d "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine} ] ; then
mkdir -p "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/wine || exit 1cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/app.ini "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Backup "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Readback "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/ini "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/log "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/*.lua "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span> || exit 1 cp -r /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/regpatch.reg "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/wine || exit 1 ln -s /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/<span class="token variable">${pkgname<span class="token operator">/</span>pc-wine<span class="token operator">/</span>PC(PC V1.44 用于升级V2.00前的固件)}</span>.exe "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/<span class="token variable">${pkgname<span class="token operator">/</span>-wine<span class="token operator">/</span>-old}</span> || exit 1 ln -s -T /<span class="token variable">${pkgdir}</span>/<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Driver "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Driver || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/EMMC "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/EMMC || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Help "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/Help || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/USBBus "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/USBBus || exit 1 ln -s -T /<span class="token variable">${armfly}</span>/<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/ChangeLog.txt "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/ChangeLog.txt || exit 1
fi
if [ ! -f "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/fontok ] ; then
touch "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/fontok || exit 1
cd "\(HOME</span>"/.<span class="token variable">\){pkgname%-wine}/wine && regedit regpatch.reg && wineserver -k
fiwine "<span class="token environment constant">$HOME</span>"/.<span class="token variable">${pkgname<span class="token operator">%</span>-wine}</span>/<span class="token variable">${pkgname<span class="token operator">/</span>-wine<span class="token operator">/</span>-old}</span> -opengl"<span class="token variable">$@</span>"
EOF
<span class="token function">install</span> -Dm0644 /dev/stdin <span class="token string">"<span class="token variable">${pkgdir}</span>/usr/share/applications/<span class="token variable">${pkgname<span class="token operator">/</span>-wine<span class="token operator">/</span>-old}</span>.desktop"</span> <span class="token operator"><<</span> <span class="token string">EOF
[Desktop Entry]
Name=\({pkgname<span class="token operator">/</span>-wine<span class="token operator">/</span>-old}</span> Name[zh_CN]=<span class="token variable">\){pkgname/-wine/-old}
Comment=Wine H7-TOOL 旧版的 PC 上位机,支持串口、CAN、示波器、CMSIS-DAP、DS18B20、RTT Viewer、脱机烧录等MimeType=application/x-${pkgname%-wine};
Exec=\({pkgname<span class="token operator">/</span>-wine<span class="token operator">/</span>-old}</span> %f Type=Application Categories=Development;Tool; Terminal=false Icon=<span class="token variable">\){pkgname%-wine}.png
Version=1.44
EOF<span class="token function">install</span> -Dm644 /dev/stdin <span class="token string">"<span class="token variable">${pkgdir}</span>/etc/udev/rules.d/10-h7tool.rules"</span> <span class="token operator"><<</span> <span class="token string">EOF
Copy this file to /etc/udev/rules.d/ or /usr/lib/udev/rules.d/
If rules fail to reload automatically, you can refresh udev rules
with the command "sudo udevadm control --reload"
ACTION!="add|change", GOTO="h7tool_rules_end"
SUBSYSTEM=="gpio", MODE="0660", GROUP="plugdev", TAG+="uaccess"
SUBSYSTEM!="usb|tty|hidraw", GOTO="h7tool_rules_end"
Please keep this list sorted by VID:PID
H7-tool
ATTRS{idVendor}"C251", ATTRS{idProduct}"F00A", MODE="666", GROUP="plugdev", TAG+="uaccess"
CMSIS-DAP compatible adapters
ATTRS{product}=="CMSIS-DAP", MODE="666", GROUP="plugdev", TAG+="uaccess"
LABEL="h7tool_rules_end"
EOF<span class="token function">tar</span> -xf <span class="token string">"<span class="token variable">${srcdir}</span>/icons.tar.gz"</span> -C <span class="token string">"<span class="token variable">${pkgdir}</span>/usr/share"</span>
# install -Dm0644 "\({srcdir}/\){pkgname%-wine}/LICENSE" "\({pkgdir}/usr/share/licenses/\){pkgname%-wine}/LICENSE"
}
h7toolpc-wine.install
# h7toolpc-wine.install
info() {
echo -e "Wine H7-TOOL 的 PC 上位机,支持串口、CAN、示波器、CMSIS-DAP、DS18B20、RTT Viewer、脱机烧录等"
}
post_install() {
info
}
post_upgrade() {
echo "deleting the h7toolpc bottle..."
find /home -maxdepth 2 -name ".h7toolpc" -exec rm -rf {} \;
info
}
pre_remove() {
echo "deleting the h7toolpc bottle..."
find /home -maxdepth 2 -name ".h7toolpc" -exec rm -rf {} \;
}
废话不多说直接上图:
本文来自博客园,作者:饕餮人,转载请注明原文链接:https://www.cnblogs.com/taotieren/articles/18458852