summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Rękorajski2012-02-13 21:06:13 (GMT)
committercvs2git2012-06-24 12:13:13 (GMT)
commit86d46ed3a66698e2f5b104ff0a4a6f30e63d17c1 (patch)
tree448405f721782650e5425c7d4a141d2130630c9d
parent4b2a14fb7f0d798bf5c90976413341377056e03d (diff)
downloadgpm-86d46ed3a66698e2f5b104ff0a4a6f30e63d17c1.zip
gpm-86d46ed3a66698e2f5b104ff0a4a6f30e63d17c1.tar.gz
- added systemd support - upstart script moved to separate package Changed files: gpm.init -> 1.33 gpm.service -> 1.1 gpm.spec -> 1.176 gpm.sysconfig -> 1.11
-rw-r--r--gpm.init3
-rw-r--r--gpm.service13
-rw-r--r--gpm.spec82
-rw-r--r--gpm.sysconfig55
4 files changed, 90 insertions, 63 deletions
diff --git a/gpm.init b/gpm.init
index b73b14b..c868645 100644
--- a/gpm.init
+++ b/gpm.init
@@ -34,9 +34,6 @@ start() {
return
fi
- [ -z "$DEVICE" ] && nls "Please set %s in /etc/sysconfig/mouse" "DEVICE"
- [ -z "$MOUSETYPE" ] && nls "Please set %s in /etc/sysconfig/mouse" "MOUSETYPE"
-
msg_starting "Gpm"
OPTIONS=""
[ -n "$DEVICE" ] && OPTIONS="-m $DEVICE"
diff --git a/gpm.service b/gpm.service
new file mode 100644
index 0000000..6f10f70
--- /dev/null
+++ b/gpm.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Console Mouse manager
+After=syslog.target
+
+[Service]
+StandardOutput=syslog
+Type=forking
+EnvironmentFile=/etc/sysconfig/mouse
+ExecStart=/usr/sbin/gpm $GPM_OPTIONS
+PIDFile=/var/run/gpm.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gpm.spec b/gpm.spec
index eff99a9..6e1c3c1 100644
--- a/gpm.spec
+++ b/gpm.spec
@@ -14,7 +14,7 @@ Summary(tr.UTF-8): Genel amaçlı fare desteği
Summary(uk.UTF-8): Сервер роботи з мишою для консолі Linux
Name: gpm
Version: 1.20.6
-Release: 10
+Release: 11
Epoch: 1
License: GPL v2+
Group: Daemons
@@ -24,6 +24,7 @@ Source1: %{name}.init
Source2: %{name}.sysconfig
Source3: http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2
Source4: %{name}.upstart
+Source5: %{name}.service
# Source3-md5: 893cf1468604523c6e9f9257a5671688
Patch0: %{name}-info.patch
Patch1: %{name}-DESTDIR.patch
@@ -37,11 +38,12 @@ BuildRequires: automake
BuildRequires: bison
BuildRequires: gawk
BuildRequires: ncurses-devel >= 5.0
-BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: rpmbuild(macros) >= 1.626
BuildRequires: texinfo
Requires(post,preun): /sbin/chkconfig
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
Requires: rc-scripts >= 0.4.3.0
+Requires: systemd-units >= 37-0.10
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -221,6 +223,19 @@ Emacs mode files for GPM.
%description emacs -l pl.UTF-8
Pliki trybu GPM dla Emacsa.
+%package upstart
+Summary: Upstart job description for gpm
+Summary(pl.UTF-8): Opis zadania Upstart dla gpm
+Group: Daemons
+Requires: %{name} = %{version}-%{release}
+Requires: upstart >= 0.6
+
+%description upstart
+Upstart job description for gpm.
+
+%description upstart -l pl.UTF-8
+Opis zadania Upstart dla gpm.
+
%prep
%setup -q
%patch0 -p1
@@ -245,7 +260,7 @@ sed -i -e 's#/usr##' doc/manpager
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,init}
+install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,init},%{systemdunitdir}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
@@ -256,6 +271,8 @@ install -p src/prog/mouse-test src/prog/hltest $RPM_BUILD_ROOT%{_sbindir}
install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/gpm
install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/mouse
cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/init/gpm.conf
+cp -a %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/gpm.service
+
bzip2 -dc %{SOURCE3} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
@@ -272,26 +289,75 @@ rm -rf $RPM_BUILD_ROOT
/sbin/chkconfig --add gpm
%service gpm restart "gpm daemon"
+%systemd_post gpm.service
%preun
if [ "$1" = "0" ]; then
%service gpm stop
/sbin/chkconfig --del gpm
fi
+%systemd_preun gpm.service
-%postun -p /sbin/postshell
--/usr/sbin/fix-info-dir -c %{_infodir}
+%postun
+[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
+%systemd_reload
+
+%triggerpostun -- %{name} < 1:1.20.6-11
+if [ -f /etc/sysconfig/mouse ]; then
+ . /etc/sysconfig/mouse
+ OPTIONS=""
+ if [ -n "$DEVICE" ]; then
+ OPTIONS="-m $DEVICE"
+ else
+ OPTIONS="-m /dev/input/mice"
+ fi
+ if [ -n "$MOUSETYPE" ]; then
+ OPTIONS="$OPTIONS -t $MOUSETYPE"
+ else
+ OPTIONS="$OPTIONS -t imps2"
+ fi
+ [ -n "$BAUD_RATE" ] && OPTIONS="$OPTIONS -b $BAUD_RATE"
+ [ -n "$CLEAR_LINES" ] && OPTIONS="$OPTIONS -o $CLEAR_LINES"
+ [ -n "$BUTTON_SEQ" ] && OPTIONS="$OPTIONS -B $BUTTON_SEQ"
+ [ -n "$TAP_BUTTON" ] && OPTIONS="$OPTIONS -g $TAP_BUTTON"
+ [ -n "$ACCEL" ] && OPTIONS="$OPTIONS -a $ACCEL"
+ [ -n "$DELTA" ] && OPTIONS="$OPTIONS -d $DELTA"
+ [ -n "$INTERVAL" ] && OPTIONS="$OPTIONS -i $INTERVAL"
+ [ -n "$RESP" ] && OPTIONS="$OPTIONS -r $RESP"
+ [ -n "$SAMPLE_RATE" ] && OPTIONS="$OPTIONS -s $SAMPLE_RATE"
+ [ -n "$CHARSET" ] && OPTIONS="$OPTIONS -l \\\"$CHARSET\\\""
+ [ "$BUTTON_COUNT" = "2" ] && OPTIONS="$OPTIONS -2"
+ [ "$BUTTON_COUNT" = "3" ] && OPTIONS="$OPTIONS -3"
+ if [ -n "$POINTER_VIS" ] && [ "$POINTER_VIS" != "no" ]; then
+ OPTIONS="$OPTIONS -p"
+ fi
+ if [ -n "$REPEATER" ] && [ "$REPEATER" != "no" ]; then
+ OPTIONS="$OPTIONS -R"
+ fi
+ %{__cp} -f /etc/sysconfig/mouse{,.rpmsave}
+ [ -f /etc/sysconfig/mouse.rpmnew ] && %{__cp} -f /etc/sysconfig/mouse{.rpmnew,}
+ echo >>/etc/sysconfig/mouse
+ echo "# Added by rpm trigger" >>/etc/sysconfig/mouse
+ echo "GPM_OPTIONS=\"$OPTIONS\"" >>/etc/sysconfig/mouse
+fi
+%systemd_trigger gpm.service
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
+%post upstart
+%upstart_post gpm
+
+%postun upstart
+%upstart_postun gpm
+
%files
%defattr(644,root,root,755)
%doc BUGS Changes README TODO doc/FAQ doc/README* conf/*.conf
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gpm-root.conf
%attr(754,root,root) /etc/rc.d/init.d/gpm
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mouse
-%config(noreplace) %verify(not md5 mtime size) /etc/init/gpm.conf
+%{systemdunitdir}/gpm.service
%attr(755,root,root) %{_bindir}/display-buttons
%attr(755,root,root) %{_bindir}/display-coords
@@ -330,3 +396,7 @@ fi
%files emacs
%defattr(644,root,root,755)
%{_datadir}/emacs/site-lisp/*.el*
+
+%files upstart
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) /etc/init/gpm.conf
diff --git a/gpm.sysconfig b/gpm.sysconfig
index 69e5ef9..3a6399b 100644
--- a/gpm.sysconfig
+++ b/gpm.sysconfig
@@ -1,60 +1,7 @@
# Customized settings for gpm
# Check out "man gpm" for detailed setup options
-# Mouse device (for example /dev/mouse, /dev/ttyS0, /dev/psaux, /dev/input/mice)
-DEVICE=/dev/input/mice
-
-# Mouse type (ms, msc, ps2, ...) Use "gpm -m /dev/mouse -t help" for detailed list
-MOUSETYPE=imps2
-
-# Force specified button count (2/3)
-BUTTON_COUNT=
-
-# Device baud rate (default == 1200)
-BAUD_RATE=
-
-# Clear some serial lines on startup. May be "dtr", "rts" or "both".
-# Needed by some strange serial mice (for example A4Tech NWW-9)
-CLEAR_LINES=
-
-# Acceleration (default 2) - delta multiplying factor:
-ACCEL=
-
-# Delta (must be 2 or more):
-DELTA=
-
-# Multiple click max interval (in milliseconds)
-INTERVAL=
-
-# Mouse responsiveness
-RESP=
-
-# Mouse device sample frequency
-SAMPLE_RATE=
-
-# Button sequence ("123" by default). May be useful for left-handed people
-# ("321" reverts button order)
-BUTTON_SEQ=
-
-# Which button should be considered pressed if touchpad was "tapped"
-# (1,2,3)
-TAP_BUTTON=
-
-# when "yes", gpm shows mouse pointer during text selection
-POINTER_VIS=no
-
-# should gpm repeat received data to /dev/gpmdata (using MouseSystems
-# protocol). May be useful for other programs that would like to use
-# mouse while gpm is running (does not require port access)
-REPEATER=no
-
-# word-constituent characters. For example:
-# "a-zA-Z0-9_󶿼ʣӦ" selects polish national characters as
-# word-constituent. This is necessary as gpm does not support locales.
-CHARSET=
-
-# other gpm options, for example when you need multiple devices support
-GPM_OPTIONS=
+GPM_OPTIONS="-m /dev/input/mice -t imps2"
# Nice level for gpm
SERVICE_RUN_NICE_LEVEL="-1"