From 8b9bc25cc615f7e8ba86ce51d2dd83220a4e084f Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 29 Sep 2020 19:28:37 -0400 Subject: WIP: add rpm spec --- myautomount.spec | 85 ++++++++++++++++++++++ .../libexec/myautomount/myautomount-initialize.sh | 4 +- 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 myautomount.spec diff --git a/myautomount.spec b/myautomount.spec new file mode 100644 index 0000000..2c00c48 --- /dev/null +++ b/myautomount.spec @@ -0,0 +1,85 @@ +# File: myautomount.spec +# Location: myautomount source +# Author: bgstack15 +# Startdate: 2020-09-29 +# Title: Rpm Spec for Myautomount Package +# Purpose: Provide build instructions for Fedora rpm for package +# History: +# Usage: +# Reference: +# bgscripts.spec +# https://src.fedoraproject.org/rpms/crypto-policies/blob/master/f/crypto-policies.spec +# Improve: +# Documentation: +# Dependencies: + +%global use_master 0 +%if !0%{?use_master} +%global git_date 20200929 +%global git_commit cdfc069c4181e83b62b411ecfcdcc936f65ea87e +%{?git_commit:%global git_commit_hash %(c=%{git_commit}; echo ${c:0:7})} +%else +%endif + +%define debug_package %{nil} +%global _python_bytecompile_errors_terminate_build 0 + +Summary: tray icon for removable media +Name: myautomount +%if ! 0%{?use_master} +Version: %{git_date} +Release: 1.git%{git_commit_hash} +%else +Version: %( date "+%F" ) +Release: 1 +%endif +License: CC BY-SA 4.0 and BSD-2-Clause +Group: Applications/System +%if ! 0%{?use_master} +Source: https://gitlab.com/bgstack15/%{name}/-/archive/%{git_commit}/%{name}-%{git_commit}.tar.gz +%else +Source: https://gitlab.com/bgstack15/%{name}/-/archive/master/%{name}-master.tar.gz +%endif +URL: https://bgstack15.wordpress.com/ +Packager: B Stack +Requires: autofs +Requires: python3-inotify +BuildRequires: txt2man +Buildarch: noarch + +%description +Myautomount uses the power of autofs to present a system tray icon +that lists mountable removable media. + +%prep +%setup -q -c %{name} + +%build +export srcdir="$( find . -type d -name 'src' -printf '%%P' )" +%make_build -C "${srcdir}" + +%install +export srcdir="$( find . -type d -name 'src' -printf '%%P' )" +%make_install -C "${srcdir}" +DESTDIR=%{buildroot} %{__make} -C "${srcdir}" initialize +exit 0 + +%clean +rm -rf %{buildroot} + +%preun +exit 0 + +%postun + +%files +%config %attr(666, -, -) %{_sysconfdir}/%{name}.conf +%{_sysconfdir}/xdg/autostart +%{_bindir}/* +%{_libexecdir}/%{name}/* +%doc %{_mandir}/man1/* +%doc %{_pkgdocdir}/* + +%changelog +* Tue Sep 29 2020 B Stack - 0.0.1-1 +- Initial package build diff --git a/src/usr/libexec/myautomount/myautomount-initialize.sh b/src/usr/libexec/myautomount/myautomount-initialize.sh index cbcb5d6..ea87759 100644 --- a/src/usr/libexec/myautomount/myautomount-initialize.sh +++ b/src/usr/libexec/myautomount/myautomount-initialize.sh @@ -11,11 +11,11 @@ setupSystem() { _needrestart=0 mkdir -m0755 -p "${MYA_PREFIX}${AUTOMOUNT_DIR}" || fail "Could not setup autofs rules! Check if this is being run as root?" ! test -f "${MYA_PREFIX}${AUTOMOUNT_FILE}" && { - { touch "${MYA_PREFIX}${AUTOMOUNT_FILE}" && echo "* -fstype=auto,rw,nosuid,uid=${USER},gid=users :/dev/& " > "${AUTOMOUNT_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?" + { touch "${MYA_PREFIX}${AUTOMOUNT_FILE}" && echo "* -fstype=auto,rw,nosuid,uid=${USER},gid=users :/dev/& " > "${MYA_PREFIX}${AUTOMOUNT_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?" _needrestart=1 } ! test -f "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" && { - { touch "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" && echo "${AUTOMOUNT_BROWSEDIR} ${AUTOMOUNT_FILE} --timeout=5 " > "${AUTOMOUNT_DIR_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?" + { touch "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" && echo "${AUTOMOUNT_BROWSEDIR} ${AUTOMOUNT_FILE} --timeout=5 " > "${MYA_PREFIX}${AUTOMOUNT_DIR_FILE}" ; } || fail "Could not setup autofs rules! Check if this is being run as root?" _needrestart=1 } test ${_needrestart} -eq 1 && eval "service autofs restart" -- cgit