Skip to content

Commit

Permalink
Add aarch64 support (#49)
Browse files Browse the repository at this point in the history
* naive aarch64 support

* Detect 64 bit more properly

* [patchmanager.spec] Beautify (only)

- Eliminate BASHisms (which was not functionally necessary, because busybox's ash supports them)
- Enhance wording and grammar in strings
- Ease understanding the code: ":" -> "true" etc.
- Proper quoting (better too often than too rarely)

* Include @nephros' commit d019e90

Include @nephros' commit d019e90 "[cleanup] fix ancient typo in .spec %pre" to avoid the necessity for rebasing.

* [patchmanager.spec] Enhance comment

* Use RPM variables & Rebase

... manually to recent fixes.

* [systemd] use _userunitdir macro in .spec file

* [aarch64] use LIBDIR variable instead of hardcoded path

* Only call /sbin/ldconfig if necessary

... when uninstalling.

* Use RPM varaible %{name} consistently

* aarch64 yaml entry for build

Co-authored-by: olf <Olf0@users.noreply.github.com>
Co-authored-by: nephros <nemo@pgxperia10>
  • Loading branch information
3 people authored Sep 20, 2021
1 parent 409f245 commit b596105
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 32 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,22 @@ jobs:
mb2 -t SailfishOS-$RELEASE-armv7hl build ;
sudo cp -r RPMS/*.rpm /share/output"

- name: Build aarch64
run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c "
mkdir -p build ;
cd build ;
cp -r /share/* . ;
mb2 -t SailfishOS-$RELEASE-aarch64 build ;
sudo cp -r RPMS/*.rpm /share/output"

- name: Build i486
run: docker run --rm --privileged -v $PWD:/share coderus/sailfishos-platform-sdk:$RELEASE /bin/bash -c "
mkdir -p build ;
cd build ;
cp -r /share/* . ;
mb2 -t SailfishOS-$RELEASE-i486 build ;
sudo cp -r RPMS/*.rpm /share/output"

- name: Upload build result
uses: actions/upload-artifact@v2
with:
Expand Down
58 changes: 28 additions & 30 deletions rpm/patchmanager.spec
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
%define theme sailfish-default

# These macros should already be defined in the RPMbuild environment, see: rpm --showrc
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
%{!?qmake5_install:%define qmake5_install make install INSTALL_ROOT=%{buildroot}}

Name: patchmanager

Summary: Patchmanager allows you to manage Sailfish OS patches
Summary: Patchmanager allows for managing Sailfish OS patches
Version: 3.0.1
Release: 1
Group: Qt/Qt
Expand All @@ -30,8 +32,7 @@ BuildRequires: pkgconfig(rpm)
BuildRequires: pkgconfig(popt)

%description
patchmanager allows managing Sailfish OS patches
on your device easily.
%{summary} on your device easily.

%prep
%setup -q -n %{name}-%{version}
Expand All @@ -55,51 +56,48 @@ ln -s ../dbus-org.SfietKonstantin.patchmanager.service %{buildroot}%{_unitdir}/m
mkdir -p %{buildroot}%{_unitdir}/timers.target.wants/
ln -s ../checkForUpdates-org.SfietKonstantin.patchmanager.timer %{buildroot}%{_unitdir}/timers.target.wants/

mkdir -p %{buildroot}/usr/lib/systemd/user/lipstick.service.wants/
ln -s ../lipstick-patchmanager.service %{buildroot}/usr/lib/systemd/user/lipstick.service.wants/
mkdir -p %{buildroot}/%{_userunitdir}/lipstick.service.wants/
ln -s ../lipstick-patchmanager.service %{buildroot}/%{_userunitdir}/lipstick.service.wants/

mkdir -p %{buildroot}%{_datadir}/%{name}/patches

%pre
export NO_PM_PRELOAD=1
case "$*" in
1)
echo Installing package
echo "Installing %{name}: pre section"
;;
2)
echo Upgrading package
// unapply patches if pm2 is installed
echo "Updating %{name}: pre section"
# Unapply all patches if Patchmanager 2.x is installed
if [ ! -d /var/lib/patchmanager/ausmt/patches/ ]
then
exit 0
else
/usr/sbin/patchnamager --unapply-all || :
/usr/sbin/patchmanager --unapply-all || true
fi
if [ "$(ls -A /var/lib/patchmanager/ausmt/patches/)" ]
if [ -n "$(ls -A /var/lib/patchmanager/ausmt/patches/)" ]
then
echo "Unapply all patches before upgrade!"
echo "Unapply all patches before updating %{name}!"
exit 1
fi
;;
*) echo case "$*" not handled in pre
*) echo "Case $* is not handled in pre section of %{name}!"
esac

%post
export NO_PM_PRELOAD=1
case "$*" in
1)
echo Installing package
echo "Installing %{name}: post section"
;;
2)
echo Upgrading package
echo "Updating %{name}: post section"
;;
*) echo case "$*" not handled in post
*) echo "Case $* is not handled in post section of %{name}!"
esac
if grep libpreloadpatchmanager /etc/ld.so.preload > /dev/null; then
echo "Preload already exists"
else
echo /usr/lib/libpreloadpatchmanager.so >> /etc/ld.so.preload
fi
sed -i "/libpreload%{name}/ d" /etc/ld.so.preload
echo "%{_libdir}/libpreload%{name}.so" >> /etc/ld.so.preload
/sbin/ldconfig
dbus-send --system --type=method_call \
--dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
Expand All @@ -112,30 +110,30 @@ systemctl restart checkForUpdates-org.SfietKonstantin.patchmanager.timer
export NO_PM_PRELOAD=1
case "$*" in
0)
echo Uninstalling package
echo "Uninstalling %{name}: preun section"
systemctl stop dbus-org.SfietKonstantin.patchmanager.service
;;
1)
echo Upgrading package
echo "Updating %{name}: preun section"
;;
*) echo case "$*" not handled in preun
*) echo "Case $* is not handled in preun section of %{name}!"
esac

%postun
export NO_PM_PRELOAD=1
case "$*" in
0)
echo Uninstalling package
sed -i "/libpreloadpatchmanager/ d" /etc/ld.so.preload
rm -rf /tmp/patchmanager || :
rm -f /tmp/patchmanager-socket || :
echo "Uninstalling %{name}: postun section"
sed -i "/libpreload%{name}/ d" /etc/ld.so.preload
/sbin/ldconfig
rm -rf /tmp/patchmanager || true
rm -f /tmp/patchmanager-socket || true
;;
1)
echo Upgrading package
echo "Updating %{name}: postun section"
;;
*) echo case "$*" not handled in postun
*) echo "Case $* is not handled in postun section of %{name}!"
esac
/sbin/ldconfig
dbus-send --system --type=method_call \
--dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
systemctl daemon-reload
Expand Down
2 changes: 1 addition & 1 deletion src/preload/preload.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ SOURCES += \
src/preloadpatchmanager.c

TARGET = preloadpatchmanager
target.path = /usr/lib
target.path = $$LIBDIR

INSTALLS = target

0 comments on commit b596105

Please sign in to comment.