Merge pull request #1367 from Kingtous/master

feat: deb/arch flutter package
This commit is contained in:
RustDesk 2022-08-26 14:59:23 +08:00 committed by GitHub
commit 8c9a3ac955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 175 additions and 67 deletions

View File

@ -1,5 +1,5 @@
pkgname=rustdesk
pkgver=1.1.9
pkgver=1.1.10
pkgrel=0
epoch=
pkgdesc=""
@ -27,5 +27,5 @@ package() {
install -Dm 644 $HBB/rustdesk.service -t "${pkgdir}/usr/share/rustdesk/files"
install -Dm 644 $HBB/rustdesk.desktop -t "${pkgdir}/usr/share/rustdesk/files"
install -Dm 644 $HBB/pynput_service.py -t "${pkgdir}/usr/share/rustdesk/files"
install -Dm 644 $HBB/256-no-margin.png "${pkgdir}/usr/share/rustdesk/files/rustdesk.png"
install -Dm 644 $HBB/128x128@2x.png "${pkgdir}/usr/share/rustdesk/files/rustdesk.png"
}

View File

@ -66,6 +66,8 @@ def make_parser():
default='',
help='Integrate features, windows only.'
'Available: IddDriver, PrivacyMode. Special value is "ALL" and empty "". Default is empty.')
parser.add_argument('--flutter', action='store_true',
help='Build flutter package', default=False)
parser.add_argument(
'--hwcodec',
action='store_true',
@ -114,9 +116,58 @@ def get_features(args):
features.extend(get_rc_features(args))
if args.hwcodec:
features.append('hwcodec')
if args.flutter:
features.append('flutter')
print("features:", features)
return features
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('strip build/linux/x64/release/liblibrustdesk.so')
os.system('mkdir -p tmpdeb/usr/lib/rustdesk')
os.system('mkdir -p tmpdeb/usr/share/rustdesk/files/systemd/')
os.system(
'cp -r build/linux/x64/release/bundle/* tmpdeb/usr/lib/rustdesk/')
os.system(
'pushd tmpdeb && ln -s /usr/lib/rustdesk/flutter_hbb usr/bin/rustdesk && popd')
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/')
os.system(
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
os.system(
'cp ../pynput_service.py tmpdeb/usr/share/rustdesk/files/')
os.system(
'cp ../128x128@2x.png tmpdeb/usr/share/rustdesk/files/rustdesk.png')
os.system(
'cp rustdesk.desktop tmpdeb/usr/share/applications/rustdesk.desktop')
os.system('mkdir -p tmpdeb/DEBIAN')
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')
md5_file('usr/share/rustdesk/files/pynput_service.py')
os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/')
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
os.chdir("..")
def build_flutter_arch_manjaro(version):
os.chdir('flutter')
os.system('flutter build linux --release')
os.system('strip build/linux/x64/release/liblibrustdesk.so')
os.system("sed -i 's/pkgver=.*/pkgver=%s/g' PKGBUILD" % version)
# pacman -S -needed base-devel
os.system('HBB=`pwd` makepkg -f')
os.system(
'mv rustdesk-%s-0-x86_64.pkg.tar.zst ../rustdesk-%s-manjaro-arch.pkg.tar.zst' % (version, version))
os.chdir('..')
def main():
parser = make_parser()
args = parser.parse_args()
@ -135,6 +186,7 @@ def main():
os.system('git checkout src/ui/common.tis')
version = get_version()
features = ",".join(get_features(args))
flutter = args.flutter
if windows:
os.system('cargo build --release --features ' + features)
# os.system('upx.exe target/release/rustdesk.exe')
@ -146,14 +198,18 @@ def main():
else:
print('Not signed')
os.system(f'cp -rf target/release/RustDesk.exe rustdesk-{version}-setdown.exe')
elif os.path.isfile('/usr/bin/pacman'):
os.system('cargo build --release --features ' + features)
elif os.path.isfile('/usr/bin/pacman1'):
if flutter:
build_flutter_arch_manjaro(version)
else:
# os.system('cargo build --release --features ' + features)
os.system('git checkout src/ui/common.tis')
os.system('strip target/release/rustdesk')
os.system("sed -i 's/pkgver=.*/pkgver=%s/g' PKGBUILD" % version)
# pacman -S -needed base-devel
os.system('HBB=`pwd` makepkg -f')
os.system('mv rustdesk-%s-0-x86_64.pkg.tar.zst rustdesk-%s-manjaro-arch.pkg.tar.zst' % (version, version))
os.system(
'mv rustdesk-%s-0-x86_64.pkg.tar.zst rustdesk-%s-manjaro-arch.pkg.tar.zst' % (version, version))
# pacman -U ./rustdesk.pkg.tar.zst
elif os.path.isfile('/usr/bin/yum'):
os.system('cargo build --release --features ' + features)
@ -172,6 +228,15 @@ def main():
# yum localinstall rustdesk.rpm
else:
os.system('cargo bundle --release --features ' + features)
if flutter:
if osx:
# todo: OSX build
pass
else:
os.system(
'mv target/release/bundle/deb/rustdesk*.deb ./flutter/rustdesk.deb')
build_flutter_deb(version)
else:
if osx:
os.system(
'strip target/release/bundle/osx/RustDesk.app/Contents/MacOS/rustdesk')
@ -198,7 +263,8 @@ codesign -s "Developer ID Application: {0}" --force --options runtime ./target/
codesign -s "Developer ID Application: {0}" --force --options runtime ./target/release/bundle/osx/RustDesk.app
'''.format(pa))
os.system('create-dmg target/release/bundle/osx/RustDesk.app')
os.rename('RustDesk %s.dmg' % version, 'rustdesk-%s.dmg' % version)
os.rename('RustDesk %s.dmg' %
version, 'rustdesk-%s.dmg' % version)
if pa:
os.system('''
#rcodesign sign --p12-file ~/.p12/rustdesk-developer-id.p12 --p12-password-file ~/.p12/.cert-pass --code-signature-flags runtime ./rustdesk-{1}.dmg
@ -210,14 +276,17 @@ rcodesign notarize --api-issuer 69a6de7d-2907-47e3-e053-5b8c7c11a4d1 --api-key 9
else:
print('Not signed')
else:
os.system('mv target/release/bundle/deb/rustdesk*.deb ./rustdesk.deb')
# buid deb package
os.system(
'mv target/release/bundle/deb/rustdesk*.deb ./rustdesk.deb')
os.system('dpkg-deb -R rustdesk.deb tmpdeb')
os.system('mkdir -p tmpdeb/usr/share/rustdesk/files/systemd/')
os.system(
'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
os.system(
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
os.system('cp pynput_service.py tmpdeb/usr/share/rustdesk/files/')
os.system(
'cp pynput_service.py tmpdeb/usr/share/rustdesk/files/')
os.system('cp -a DEBIAN/* tmpdeb/DEBIAN/')
os.system('strip tmpdeb/usr/bin/rustdesk')
os.system('mkdir -p tmpdeb/usr/lib/rustdesk')

19
flutter/rustdesk.desktop Normal file
View File

@ -0,0 +1,19 @@
[Desktop Entry]
Version=1.1.10
Name=RustDesk
GenericName=Remote Desktop
Comment=Remote Desktop
Exec=/usr/lib/rustdesk/flutter_hbb %u
Icon=/usr/share/rustdesk/files/rustdesk.png
Terminal=false
Type=Application
StartupNotify=true
Categories=Network;RemoteAccess;GTK;
Keywords=internet;
Actions=new-window;
X-Desktop-File-Install-Version=0.23
[Desktop Action new-window]
Name=Open a New Window

16
flutter/rustdesk.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=RustDesk
Requires=network.target
After=systemd-user-sessions.service
[Service]
Type=simple
ExecStart=/usr/lib/rustdesk/flutter_hbb --service
PIDFile=/run/rustdesk.pid
KillMode=mixed
TimeoutStopSec=30
User=root
LimitNOFILE=100000
[Install]
WantedBy=multi-user.target

View File

@ -23,7 +23,7 @@ mkdir -p %{buildroot}/usr/share/rustdesk/files/
install -m 755 $HBB/target/release/rustdesk %{buildroot}/usr/bin/rustdesk
install $HBB/libsciter-gtk.so %{buildroot}/usr/lib/rustdesk/libsciter-gtk.so
install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/
install $HBB/256-no-margin.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/
install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/

View File

@ -23,7 +23,7 @@ mkdir -p %{buildroot}/usr/share/rustdesk/files/
install -m 755 $HBB/target/release/rustdesk %{buildroot}/usr/bin/rustdesk
install $HBB/libsciter-gtk.so %{buildroot}/usr/lib/rustdesk/libsciter-gtk.so
install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/
install $HBB/256-no-margin.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/
install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/

View File

@ -19,6 +19,10 @@ pub fn core_main() -> bool {
start_os_service();
return false;
}
if args[1] == "--server" {
// TODO: server
return false;
}
}
true
}