Last active
February 24, 2023 20:50
-
-
Save alealexpro100/9e3f9a00dd1baaf605d64f373a3ab187 to your computer and use it in GitHub Desktop.
Build Rustdesk-Server under Alpine Linux + service to run it (based on samba service file).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
declare packages="git alpine-sdk cargo" | |
declare project_name="rustdesk-server" | |
echo "Installing build packages..." | |
sudo apk add $packages | |
if [[ -d $project_name ]]; then | |
cd ${project_name} | |
git pull | |
else | |
git clone https://github.com/rustdesk/${project_name}.git | |
cd ${project_name} | |
fi | |
echo "Building..." | |
#cargo build --release | |
echo "Copying binaries..." | |
cp -a target/release/{hbbs,hbbr} ../ | |
cd ../ | |
echo "Compressing files..." | |
[[ ! -f ${project_name}-release.zip ]] || rm -rf ${project_name:?}-release.zip | |
zip -9 ${project_name}-release.zip hbbr hbbs | |
echo "Complete. Have a nice day!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/openrc-run | |
name="rustdesk" | |
description="RustDesk server service" | |
daemon_list=${daemon_list:-"hbbs hbbr"} | |
user="$name" | |
group="$user" | |
home_dir="/var/opt/rustdesk-server" | |
depend() { | |
need net | |
after firewall | |
} | |
start_hbbs() { | |
start-stop-daemon --start --background \ | |
-k 0002 -u ${user} -g ${group} \ | |
--chdir ${home_dir} \ | |
--exec ${home_dir}/hbbs -- \ | |
${hbbs_options} | |
} | |
start_hbbr() { | |
start-stop-daemon --start --background \ | |
-k 0002 -u ${user} -g ${group} \ | |
--chdir ${home_dir} \ | |
--exec ${home_dir}/hbbr -- \ | |
${hbbr_options:-"-k _"} | |
} | |
stop_hbbs() { | |
start-stop-daemon --stop --exec ${home_dir}/hbbs | |
} | |
stop_hbbr() { | |
start-stop-daemon --stop --exec ${home_dir}/hbbr | |
} | |
start() { | |
for i in $daemon_list; do | |
ebegin "Starting $i" | |
start_$i | |
eend $? | |
done | |
} | |
stop() { | |
for i in $daemon_list; do | |
ebegin "Stopping $i" | |
stop_$i | |
eend $? | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If You don't want to compile it yourself, you can download compiled binaries (for Alpine Linux 3.15) here.
UPDATE: Changed to correct URL.