Fix build flutter deb

This commit is contained in:
Asura 2022-09-12 23:27:07 -07:00
parent 64f5f3253c
commit a505b73a56
4 changed files with 46 additions and 11 deletions

View File

@ -5,8 +5,10 @@ set -e
if [ "$1" = configure ]; then
INITSYS=$(ls -al /proc/1/exe | awk -F' ' '{print $NF}' | awk -F'/' '{print $NF}')
if [ "systemd" == "$INITSYS" ]; then
ln -s /usr/lib/rustdesk/flutter_hbb /usr/bin/rustdesk
if [ -e /etc/systemd/system/rustdesk.service ]; then
rm /etc/systemd/system/rustdesk.service /usr/lib/systemd/system/rustdesk.service /usr/lib/systemd/user/rustdesk.service >/dev/null 2>&1
fi
@ -18,7 +20,12 @@ if [ "$1" = configure ]; then
systemctl start rustdesk
cp /usr/share/rustdesk/files/systemd/rustdesk.service.user /usr/lib/systemd/user/rustdesk.service
curUser=$(who | awk '{print $1}' | head -1)
systemctl --machine=${curUser}@.host --user daemon-reload
ubuntuVersion=$(grep -oP 'VERSION_ID="\K[\d]+' /etc/os-release | bc -l)
waylandSupportVersion=21
if [ "$ubuntuVersion" -ge "$waylandSupportVersion" ]
then
curUser=$(who | awk '{print $1}' | head -1)
systemctl --machine=${curUser}@.host --user daemon-reload
fi
fi
fi

View File

@ -5,12 +5,17 @@ set -e
case $1 in
remove|upgrade)
INITSYS=$(ls -al /proc/1/exe | awk -F' ' '{print $NF}' | awk -F'/' '{print $NF}')
if [ "systemd" == "${INITSYS}" ]; then
rm /usr/bin/rustdesk
systemctl stop rustdesk || true
systemctl disable rustdesk || true
serverUser=$(ps -ef | grep -E 'rustdesk +--server' | awk '{print $1}' | head -1)
if [ "$serverUser" != "" ] && [ "$serverUser" != "root" ]
ubuntuVersion=$(grep -oP 'VERSION_ID="\K[\d]+' /etc/os-release | bc -l)
waylandSupportVersion=21
if [ "$serverUser" != "" ] && [ "$serverUser" != "root" ] && [ "$ubuntuVersion" -ge "$waylandSupportVersion" ]
then
systemctl --machine=${serverUser}@.host --user stop rustdesk || true
fi

View File

@ -121,15 +121,34 @@ def get_features(args):
print("features:", features)
return features
def generate_control_file(version):
control_file_path = "../DEBIAN/control"
os.system('/bin/rm -rf %s' % control_file_path)
content = """Package: rustdesk
Version: %s
Architecture: amd64
Maintainer: open-trade <info@rustdesk.com>
Homepage: https://rustdesk.com
Depends: libgtk-3-0, libxcb-randr0, libxdo3, libxfixes3, libxcb-shape0, libxcb-xfixes0, libasound2, libsystemd0, pulseaudio, curl
Description: A remote control software.
""" % version
file = open(control_file_path, "w")
file.write(content)
file.close()
def build_flutter_deb(version):
os.chdir('flutter')
os.system('dpkg-deb -R rustdesk.deb tmpdeb')
# os.system('flutter build linux --release')
os.system('rm tmpdeb/usr/bin/rustdesk')
os.system('flutter build linux --release')
os.system('strip build/linux/x64/release/liblibrustdesk.so')
os.system('mkdir -p tmpdeb/usr/bin/')
os.system('mkdir -p tmpdeb/usr/lib/rustdesk')
os.system('mkdir -p tmpdeb/usr/share/rustdesk/files/systemd/')
os.system('mkdir -p tmpdeb/usr/share/applications/')
os.system(
'cp -r build/linux/x64/release/bundle/* tmpdeb/usr/lib/rustdesk/')
os.system(
@ -137,18 +156,22 @@ def build_flutter_deb(version):
os.system(
'cp build/linux/x64/release/liblibrustdesk.so tmpdeb/usr/lib/rustdesk/librustdesk.so')
os.system(
'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
'cp ../rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
os.system(
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
'cp ../rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
os.system(
'cp ../128x128@2x.png tmpdeb/usr/share/rustdesk/files/rustdesk.png')
os.system(
'cp rustdesk.desktop tmpdeb/usr/share/applications/rustdesk.desktop')
'cp ../rustdesk.desktop tmpdeb/usr/share/applications/rustdesk.desktop')
os.system('mkdir -p tmpdeb/DEBIAN')
generate_control_file(version)
os.system('cp -a ../DEBIAN/* tmpdeb/DEBIAN/')
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service')
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user')
os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/')
os.system('dpkg-deb -b tmpdeb rustdesk.deb;')
os.system('/bin/rm -rf tmpdeb/')
os.system('/bin/rm -rf ../DEBIAN/control')
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
os.chdir("..")

View File

@ -129,7 +129,7 @@ set(RUSTDESK_LIB_BUILD_TYPE $<IF:$<CONFIG:Debug>,debug,release>)
string(TOLOWER ${CMAKE_BUILD_TYPE} ${RUSTDESK_LIB_BUILD_TYPE})
message(STATUS "rustdesk lib build type: ${RUSTDESK_LIB_BUILD_TYPE}")
set(RUSTDESK_LIB "../../target/${RUSTDESK_LIB_BUILD_TYPE}/liblibrustdesk.so")
set(RUSTDESK_LIB "../build/linux/x64/${RUSTDESK_LIB_BUILD_TYPE}/liblibrustdesk.so")
install(FILES "${RUSTDESK_LIB}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime RENAME librustdesk.so)