增加wechat

master
yutent 2024-03-11 14:33:47 +08:00
parent d26e383aea
commit c14b20c864
6 changed files with 203 additions and 0 deletions

View File

@ -0,0 +1,4 @@
DISTRIB_ID=uos
DISTRIB_RELEASE=20
DISTRIB_DESCRIPTION="UnionTech OS 20"
DISTRIB_CODENAME=plum

View File

@ -0,0 +1,8 @@
PRETTY_NAME="UnionTech OS Desktop 20 Home"
NAME="uos"
VERSION_ID="20 Home"
VERSION="20 Home"
ID=uos
HOME_URL="https://www.chinauos.com/"
BUG_REPORT_URL="http://bbs.chinauos.com"
VERSION_CODENAME=eagle

BIN
wechat/license/libuosdevicea.so Executable file

Binary file not shown.

View File

@ -0,0 +1,15 @@
{
"confCustomHeadindex": 0,
"confCustomUrl": "",
"confDefault": true,
"confDefaultIndex": 0,
"defaultUrl": [
"https://license.chinauos.com",
"https://license1.chinauos.com"
],
"options": [
{"protocol": "https://", "address": ""},
{"protocol": "http://", "address": ""},
{"protocol": "kms://","address": ""}
]
}

Binary file not shown.

176
wechat/package.sh Executable file
View File

@ -0,0 +1,176 @@
#!/bin/bash
app_name="wechat"
tmp_dir="/tmp/${app_name}_tmp"
version="1.0.0.145"
release="1.0.0.145"
deb_url="https://cdn4.cnxclm.com/uploads/2024/03/05/3VDyAc0x_wechat-beta_1.0.0.145_amd64.deb"
# 创建临时目录, 用于下载官方包
if [ -d $tmp_dir ]; then
# echo ""
rm -rf $tmp_dir
fi
if [ -d "./unpack" ]; then
sudo rm -rf ./unpack
fi
if [ -f "./${app_name}_${version}.deb" ]; then
rm "./${app_name}_${version}.deb"
fi
mkdir $tmp_dir
# 创建临时待打包目录
echo "创建待打包目录..."
mkdir -p "./unpack/DEBIAN"
mkdir -p "./unpack/usr/bin"
mkdir -p "./unpack/usr/lib/license"
mkdir -p "./unpack/usr/share/wechat-uos"
mkdir -p "./unpack/usr/share/icons/hicolor/256x256/apps"
echo "下载官方原包..."
wget $deb_url -O "${tmp_dir}/${app_name}.deb"
echo "下载完成, 解包中..."
dpkg-deb -R "${tmp_dir}/${app_name}.deb" "${tmp_dir}/${app_name}"
echo "解包完成, 复制到待打包目录..."
cp -r "${tmp_dir}/${app_name}/opt" "./unpack/"
cp -r "${tmp_dir}/${app_name}/usr" "./unpack/"
mv ./unpack/opt/wechat-beta/icons/wechat.png ./unpack/usr/share/icons/hicolor/256x256/apps/wechat.png
rm -rf ./unpack/opt/wechat-beta/icons
rm -rf $tmp_dir
echo "复制uos环境文件..."
cp -r ./license/etc ./unpack/usr/share/wechat-uos/
cp -r ./license/var ./unpack/usr/share/wechat-uos/
cp ./license/libuosdevicea.so ./unpack/usr/lib/license/libuosdevicea.so
echo "复制完成, 创建可执行文件及程序桌面入口文件..."
echo """
[Desktop Entry]
Name=WeChat
Name[zh_CN]=微信
Exec=wechat %u
Icon=wechat
Categories=Utility;Network;InstantMessaging;Chat;
Terminal=false
Type=Application
StartupWMClass=WeChat
X-GNOME-SingleWindow=true
SingleMainWindow=true
""" > "./unpack/usr/share/applications/wechat.desktop"
echo """
#!/bin/bash
# wechat only support xcb
BWRAP_ENV_APPEND=\"--setenv QT_QPA_PLATFORM xcb \"
WECHAT_HOME_DIR=\"\${HOME}/Documents/WeChat_Data\"
if [ -z \${QT_IM_MODULE} ]; then
BWRAP_ENV_APPEND=\"\${BWRAP_ENV_APPEND} --setenv QT_IM_MODULE fcitx\"
fi
case \"\$XDG_CURRENT_DESKTOP\" in
KDE)
SCALE_FACTOR=\$(kreadconfig6 --group KScreen --key ScaleFactor --default 1.0)
BWRAP_ENV_APPEND=\"\${BWRAP_ENV_APPEND} --setenv QT_SCALE_FACTOR \${SCALE_FACTOR}\"
;;
*)
BWRAP_ENV_APPEND=\"\${BWRAP_ENV_APPEND} --setenv QT_AUTO_SCREEN_SCALE_FACTOR \${QT_AUTO_SCREEN_SCALE_FACTOR:-1}\"
;;
esac
if [ -z \${GTK_USE_PORTAL} ]; then
BWRAP_ENV_APPEND=\"\${BWRAP_ENV_APPEND} --setenv GTK_USE_PORTAL 1\"
fi
if [ ! -d \"\${WECHAT_HOME_DIR}\" ]; then
mkdir -p \${WECHAT_HOME_DIR}
fi
exec bwrap \\
--dev-bind / / \\
--bind \"\${WECHAT_HOME_DIR}\" \"\${HOME}\" \\
--ro-bind /usr/share/wechat-uos/var/ /var/ \\
--ro-bind /usr/share/wechat-uos/etc/os-release /etc/os-release \\
--ro-bind /usr/share/wechat-uos/etc/lsb-release /etc/lsb-release \\
\${BWRAP_ENV_APPEND} \\
/opt/wechat-beta/wechat \$@
""" > ./unpack/usr/bin/wechat
chmod +x ./unpack/usr/bin/wechat
echo "修正完成, 计算文件md5..."
cd ./unpack
# opt目录中有文件名中带有空格, ;xargs需要处理一下
find opt/ -type f | xargs -I {} md5sum {} > DEBIAN/md5sums
find usr/ -type f | xargs md5sum >> DEBIAN/md5sums
IFS=$'\t' read -ra size <<< "$(du -d 0)"
echo """
Package: ${app_name}
Version: ${version}
Architecture: amd64
Maintainer: Yutent <yutent.io@gmail.com>
Installed-Size: ${size[0]}
Depends: bubblewrap, libssl1.1
Section: non-free/chat
Priority: optional
Homepage: https://weixin.qq.com
Description: linux wechat
""" > DEBIAN/control
echo """
#!/bin/bash -e
set -e
if [ ! -f /etc/lsb-release ]; then
touch /etc/lsb-release
fi
""" > DEBIAN/postinst
echo """
#!/bin/bash -e
set -e
if [ -f /etc/lsb-release ]; then
_cont=\"\$(cat /etc/lsb-release)\"
if [ \$_cont == \"\" ]; then
rm -f /etc/lsb-release
fi
fi
""" > DEBIAN/prerm
chmod +x DEBIAN/postinst
chmod +x DEBIAN/prerm
echo '计算文件md5完成, 打包中...'
cd ..
sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"