build: use symbolic link instead of custom script file to add command line for this software on Linux

This commit is contained in:
leo 2024-06-28 11:21:58 +08:00
parent 8dfe882455
commit f455df0937
8 changed files with 24 additions and 11 deletions

View file

@ -17,12 +17,12 @@ rm -f SourceGit/sourcegit.icns
# Debain/Ubuntu package # Debain/Ubuntu package
mkdir -p resources/deb/opt/sourcegit/ mkdir -p resources/deb/opt/sourcegit/
mkdir -p resources/deb/usr/bin
mkdir -p resources/deb/usr/share/applications mkdir -p resources/deb/usr/share/applications
mkdir -p resources/deb/usr/share/icons mkdir -p resources/deb/usr/share/icons
cp -f SourceGit/* resources/deb/opt/sourcegit/ cp -f SourceGit/* resources/deb/opt/sourcegit/
cp -r resources/_common/usr resources/deb/ cp -r resources/_common/applications resources/deb/usr/share/
chmod -R 755 resources/deb cp -r resources/_common/icons resources/deb/usr/share/
chmod +x -R resources/deb/opt/sourcegit
sed -i "2s/.*/Version: ${version}/g" resources/deb/DEBIAN/control sed -i "2s/.*/Version: ${version}/g" resources/deb/DEBIAN/control
dpkg-deb --build resources/deb ./sourcegit_${version}-1_amd64.deb dpkg-deb --build resources/deb ./sourcegit_${version}-1_amd64.deb

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -1,2 +0,0 @@
#!/bin/bash
exec /opt/sourcegit/sourcegit $1

2
build/resources/deb/DEBIAN/control Normal file → Executable file
View file

@ -1,5 +1,5 @@
Package: sourcegit Package: sourcegit
Version: 8.8 Version: 8.18
Priority: optional Priority: optional
Depends: libx11-6, libice6, libsm6 Depends: libx11-6, libice6, libsm6
Architecture: amd64 Architecture: amd64

View file

@ -0,0 +1,5 @@
#!bin/sh
echo 'Create link on /usr/bin'
ln -s /opt/sourcegit/sourcegit /usr/bin/sourcegit
exit 0

View file

@ -0,0 +1,4 @@
#!bin/sh
rm -f /usr/bin/sourcegit
exit 0

View file

@ -15,17 +15,23 @@ Open-source & Free Git Gui Client
%install %install
mkdir -p $RPM_BUILD_ROOT/opt/sourcegit mkdir -p $RPM_BUILD_ROOT/opt/sourcegit
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/usr/share/applications mkdir -p $RPM_BUILD_ROOT/usr/share/applications
mkdir -p $RPM_BUILD_ROOT/usr/share/icons mkdir -p $RPM_BUILD_ROOT/usr/share/icons
cp -r ../../_common/usr $RPM_BUILD_ROOT/ cp -r ../../_common/applications $RPM_BUILD_ROOT/usr/share/
cp -r ../../_common/icons $RPM_BUILD_ROOT/usr/share/
cp -f ../../../SourceGit/* $RPM_BUILD_ROOT/opt/sourcegit/ cp -f ../../../SourceGit/* $RPM_BUILD_ROOT/opt/sourcegit/
chmod 755 -R $RPM_BUILD_ROOT chmod 755 -R $RPM_BUILD_ROOT/opt/sourcegit
chmod 755 $RPM_BUILD_ROOT/usr/share/applications/sourcegit.desktop
%files %files
/opt /opt/sourcegit
%attr(555,root,root)/usr/bin
/usr/share /usr/share
%post
ln -s /opt/sourcegit/sourcegit /usr/bin/sourcegit
%postun
rm -f /usr/bin/sourcegit
%changelog %changelog
# skip # skip