Skip to content

Commit 33c2897

Browse files
committed
Script: modify script to support deepin
1 parent 0ccb71a commit 33c2897

7 files changed

Lines changed: 102 additions & 38 deletions

File tree

Package/debian/control.deepin.23

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# https://www.debian.org/doc/debian-policy/ch-controlfields.html
2+
3+
Source: rabbitremotecontrol
4+
Section: main
5+
Priority: optional
6+
Maintainer: Kang Lin <kl222@126.com>
7+
Build-Depends: debhelper(>=13), debhelper-compat(=13), fakeroot, cmake(>=3.21),
8+
ninja-build, qmake6, qt6-tools-dev, qt6-tools-dev-tools, qt6-base-dev, qt6-base-dev-tools,
9+
qt6-qpa-plugins, qt6-svg-dev, qt6-l10n-tools, qt6-translations-l10n,
10+
libqt6sql6-mysql, libqt6sql6-odbc, libqt6sql6-sqlite, libqt6sql6-psql,
11+
qt6-scxml-dev, qt6-multimedia-dev, qt6-serialport-dev, qt6-websockets-dev,
12+
qt6-webengine-dev, qt6-webengine-dev-tools, qt6-positioning-dev, qt6-webchannel-dev,
13+
qt6-speech-dev,
14+
libssl-dev, libcrypt-dev, libcmark-dev,
15+
freerdp2-dev, libvncserver-dev, libpcap-dev,
16+
libcurl4-openssl-dev,
17+
libmariadb-dev, libmariadb-dev-compat,
18+
libxtst-dev, libxcb1-dev, libxcb-xtest0-dev, libxcb-keysyms1-dev
19+
Standards-Version: 4.6.2
20+
Homepage: https://github.com/KangLin/RabbitRemoteControl
21+
Vcs-Git: https://github.com/KangLin/RabbitRemoteControl.git
22+
Vcs-Browser: https://github.com/KangLin/RabbitRemoteControl
23+
Rules-Requires-Root: binary-targets
24+
25+
Package: rabbitremotecontrol
26+
Section: net
27+
Architecture: any
28+
#Pre-Depends: ${misc:Pre-Depends}
29+
#Suggests: libqt6svg6
30+
Depends: libqt6sql6-mysql, libqt6sql6-sqlite, libqt6sql6-odbc, libqt6sql6-psql, libmariadb3,
31+
${shlibs:Depends}, ${misc:Depends}
32+
Replaces: rabbitcommon (>=2.3.2)
33+
Description: Rabbit Remote Control
34+
Rabbit remote control is is a cross-platform,
35+
multi-protocol remote control software.
36+
.
37+
Allows you to use any device and system in anywhere and remotely manage
38+
any device and system in any way.
39+
.
40+
It's goal is to be simple, convenient, security and easy to use, improving work efficiency.
41+
.
42+
It include remote desktop, remote control, file transfer(FTP, SFTP),
43+
terminal, remote terminal(SSH, TELNET), player, network tools etc functions.
44+
.
45+
Author: Kang Lin <kl222@126.com>
46+
.
47+
Donation:
48+
.
49+
https://github.com/KangLin/RabbitCommon/raw/master/Src/Resource/image/Contribute.png
50+
.
51+
https://gitee.com/kl222/RabbitCommon/raw/master/Src/Resource/image/Contribute.png
52+
.
53+
https://gitlab.com/kl222/RabbitCommon/-/raw/master/Src/Resource/image/Contribute.png

Script/build_android.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ if [ -z "$BUILD_VERBOSE" ]; then
1111
fi
1212

1313
source $(dirname $(readlink -f $0))/common.sh
14+
detect_os_info
1415

1516
# modify follow value
1617
Qt6_DIR=/opt/Qt/6.6.3/android_x86_64

Script/build_debpackage.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fi
1313
INSTALL_BUILD_DEPEND=0
1414

1515
source $(dirname $(readlink -f $0))/common.sh
16+
detect_os_info
1617

1718
usage_long() {
1819
echo "$0 [-h|--help] [-v|--verbose[=0|1]] [--install=<install directory>] [--rabbitcommon<RabbitCommon directory>"

Script/build_depend.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ if [ -z "$BUILD_VERBOSE" ]; then
1212
fi
1313

1414
source $(dirname $(readlink -f $0))/common.sh
15-
1615
detect_os_info
1716

1817
install_gnu_getopt
19-
if [ "$OS" = "macOS" ]; then
18+
if [ "$DISTRO" = "macOS" ]; then
2019
MACOS=1
2120
setup_macos
2221
else
@@ -558,11 +557,8 @@ if [ $BASE_LIBS -eq 1 ]; then
558557
libxcb-cursor-dev libxcb-xkb-dev libxcb-keysyms1-dev \
559558
libxcb-* libxcb-cursor0 \
560559
libxkbcommon-dev
561-
if ! [[ $DISTRO_VERSION =~ 26\.[0-9]+ ]]; then
562-
package_install xserver-xorg-input-kbd xserver-xorg-input-mouse
563-
fi
564560
# Base dependency
565-
package_install liblzo2-dev libssl-dev libcrypt-dev libicu-dev zlib1g-dev libtelnet-dev
561+
package_install liblzo2-dev libssl-dev libcrypt-dev libicu-dev zlib1g-dev
566562
# RabbitCommon dependency
567563
package_install libcmark-dev cmark
568564
# VNC dependency
@@ -573,7 +569,15 @@ if [ $BASE_LIBS -eq 1 ]; then
573569
# PcapPlusPlus dependency
574570
package_install libpcap-dev
575571
# FFmpeg needed by QtMultimedia and freerdp
576-
package_install libavcodec-dev libavformat-dev libresample1-dev libswscale-dev
572+
package_install libavcodec-dev libavformat-dev libswscale-dev
573+
case "$DISTRO" in
574+
ubuntu|debian)
575+
package_install libresample1-dev
576+
;;
577+
deepin)
578+
package_install libswresample-dev
579+
;;
580+
esac
577581
package_install libx264-dev libx265-dev
578582
# Needed by QtMultimedia
579583
package_install pipewire
@@ -582,11 +586,10 @@ if [ $BASE_LIBS -eq 1 ]; then
582586
# Needed by AppImage and FreeRDP
583587
package_install libfuse-dev libfuse3-dev fuse
584588
# Other
585-
586-
if [ "$OS" = "ubuntu" ]; then
589+
if [ "$DISTRO" = "ubuntu" ]; then
587590
package_install libmysqlclient-dev
588591
fi
589-
if [ "$OS" = "debian" ]; then
592+
if [ "$DISTRO" = "debian" ]; then
590593
# libmysqlclient
591594
package_install libmariadb-dev libmariadb-dev-compat
592595
fi

Script/build_linux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if [ -z "$BUILD_VERBOSE" ]; then
88
fi
99

1010
source $(dirname $(readlink -f $0))/common.sh
11-
1211
detect_os_info
1312

1413
install_gnu_getopt

Script/build_rpm_package.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ if [ -z "$BUILD_VERBOSE" ]; then
1111
fi
1212

1313
source $(dirname $(readlink -f $0))/common.sh
14+
detect_os_info
1415

1516
usage_long() {
1617
echo "$0 [-h|--help] [-v|--verbose[=0|1]] [--install=<install directory>]"

Script/common.sh

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ validate_directory() {
149149

150150
if [ -n "$dir" ]; then
151151
if [[ "$dir" =~ ^- ]]; then
152-
echo "Error: $type directory parameter '$dir' cannot start with '-'" >&2
152+
log_fail "Error: $type directory parameter '$dir' cannot start with '-'"
153153
exit 1
154154
fi
155155
fi
@@ -288,14 +288,20 @@ create_debian_folder() {
288288
debian:13)
289289
control_source="$repo_root/Package/debian/control.debian.13"
290290
;;
291+
deepin*)
292+
control_source="$repo_root/Package/debian/control.deepin.23"
293+
;;
291294
*)
292295
control_source="$repo_root/Package/debian/control.default"
293296
;;
294297
esac
295298
if [ -f "$control_source" ]; then
296299
ln -s $control_source $repo_root/debian/control
300+
if [ "$BUILD_VERBOSE" = "ON" ]; then
301+
echo "ln -s $control_source $repo_root/debian/control"
302+
fi
297303
else
298-
echo "Error: $control_source is not exist"
304+
log_fail "Error: $control_source is not exist"
299305
fi
300306
fi
301307

@@ -320,7 +326,7 @@ install_debian_depend() {
320326
# grep -v '^$' | \
321327
# xargs sudo apt install -y
322328
else
323-
echo "Error: $repo_root/debian/control is not exist"
329+
log_fail "Error: $repo_root/debian/control is not exist"
324330
fi
325331
}
326332

@@ -450,17 +456,17 @@ detect_os_info() {
450456
# export ARCHITECTURE=$(echo "$system_info" | grep "^Architecture:" | awk -F': ' '{print $2}')
451457

452458
# 如果是 macOS,进行初始化设置
453-
if [ "$OS" = "macOS" ]; then
459+
if [ "$DISTRO" = "macOS" ]; then
454460
setup_macos
455461
fi
456462

457463
if [ "$BUILD_VERBOSE" = "ON" ]; then
458464
echo "=== OS information (detect_os_info) ==="
459-
echo "Detected OS: $OS"
460-
echo "Distribution: $DISTRO"
461-
echo "Version: $DISTRO_VERSION"
462-
echo "Package tool: $PACKAGE_TOOL"
463-
echo "Architecture: $ARCHITECTURE"
465+
echo "Detected OS[OS]: $OS"
466+
echo "Distribution[DISTRO]: $DISTRO"
467+
echo "Version[DISTRO_VERSION]: $DISTRO_VERSION"
468+
echo "Package tool[PACKAGE_TOOL]: $PACKAGE_TOOL"
469+
echo "Architecture[ARCHITECTURE]: $ARCHITECTURE"
464470
echo "======================================="
465471
echo "PATH: $PATH"
466472
fi
@@ -495,7 +501,7 @@ version_compare() {
495501
# Function to check if git is installed
496502
check_git() {
497503
if ! command -v git >/dev/null 2>&1; then
498-
echo "X Git is not installed" >&2
504+
echo_error "X Git is not installed" >&2
499505
echo " Git is required for this script to work." >&2
500506
echo "" >&2
501507
echo " Please install Git using one of the following commands:" >&2
@@ -528,10 +534,10 @@ check_git() {
528534
local git_version=$(git --version | cut -d' ' -f3)
529535

530536
if ! version_compare "$git_version" "$min_version"; then
531-
echo "!️ Git version $git_version is installed, but version $min_version or higher is recommended" >&2
537+
echo_warn "!️ Git version $git_version is installed, but version $min_version or higher is recommended" >&2
532538
# Continue anyway, just a warning
533539
else
534-
echo "√ Git $git_version is installed"
540+
echo_success "√ Git $git_version is installed"
535541
fi
536542
fi
537543

@@ -541,7 +547,7 @@ check_git() {
541547
# Option to automatically install git (with user confirmation)
542548
install_git_if_missing() {
543549
if ! command -v git >/dev/null 2>&1; then
544-
echo "!️ Git is required but not installed." >&2
550+
echo_warn "!️ Git is required but not installed." >&2
545551
read -p "Would you like to install Git now? (y/n): " -n 1 -r
546552
echo
547553
if [[ $REPLY =~ ^[Yy]$ ]]; then
@@ -558,23 +564,23 @@ install_git_if_missing() {
558564
if command -v brew >/dev/null 2>&1; then
559565
brew install git
560566
else
561-
echo "X Homebrew not found. Please install Git manually from https://git-scm.com/download/mac" >&2
567+
echo_error "X Homebrew not found. Please install Git manually from https://git-scm.com/download/mac" >&2
562568
return 1
563569
fi
564570
else
565-
echo "X Unsupported OS. Please install Git manually." >&2
571+
echo_error "X Unsupported OS. Please install Git manually." >&2
566572
return 1
567573
fi
568574

569575
# Verify installation
570576
if command -v git >/dev/null 2>&1; then
571-
echo "√ Git installed successfully!"
577+
echo_success "√ Git installed successfully!"
572578
else
573-
echo "X Git installation failed. Please install manually." >&2
579+
echo_error "X Git installation failed. Please install manually." >&2
574580
return 1
575581
fi
576582
else
577-
echo "X Git is required. Exiting." >&2
583+
echo_error "X Git is required. Exiting." >&2
578584
return 1
579585
fi
580586
fi
@@ -597,17 +603,17 @@ test_sed_pattern() {
597603

598604
# Test with -E flag
599605
if echo "$test_string" | sed -E "s/${VERSION_PATTERN}/REPLACED/g" | grep -q "REPLACED"; then
600-
echo " √ -E flag: Matches"
606+
echo_success " √ -E flag: Matches"
601607
else
602-
echo " X -E flag: No match"
608+
echo_error " X -E flag: No match"
603609
fi
604610

605611
# Convert to BRE and test
606612
BRE_PATTERN=$(sed_safe_pattern "$VERSION_PATTERN")
607613
if echo "$test_string" | sed "s/${BRE_PATTERN}/REPLACED/g" | grep -q "REPLACED"; then
608-
echo " √ BRE: Matches"
614+
echo_success " √ BRE: Matches"
609615
else
610-
echo " X BRE: No match"
616+
echo_error " X BRE: No match"
611617
fi
612618
}
613619

@@ -656,14 +662,14 @@ version_parser() {
656662
return 0
657663
fi
658664

659-
echo "ERROR: Unable to parse version number '$version'" >&2
665+
log_fail "ERROR: Unable to parse version number '$version'" >&2
660666
return 1
661667
}
662668

663669
# 辅助函数:显示版本数组
664670
display_version_info() {
665671
local -a data=($@)
666-
672+
667673
if [[ ${#data[@]} -ge 8 ]]; then
668674
cat << EOF
669675
版本信息:
@@ -677,7 +683,7 @@ display_version_info() {
677683
是否包含构建: ${data[7]}
678684
EOF
679685
else
680-
echo "数据不完整"
686+
log_fail "数据不完整"
681687
fi
682688
}
683689

@@ -702,7 +708,7 @@ parse_version_assoc() {
702708
version_array[build]="${BASH_REMATCH[10]:-}"
703709
return 0
704710
else
705-
echo "ERROR: Unable to parse version number '$version'" >&2
711+
log_fail "ERROR: Unable to parse version number '$version'" >&2
706712
return 1
707713
fi
708714
}
@@ -772,7 +778,7 @@ compare_versions() {
772778

773779
# 检查数组元素个数
774780
if [ ${#parts1[@]} -lt 3 ] || [ ${#parts2[@]} -lt 3 ]; then
775-
echo "version format error" >&2
781+
log_fail "version format error" >&2
776782
return 3
777783
fi
778784

0 commit comments

Comments
 (0)