2010-11-11 11:59:29 +01:00
|
|
|
# need to keep this around for a while
|
|
|
|
%suse_check %{nil}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# directories
|
|
|
|
%_infodir %{_prefix}/share/info
|
|
|
|
%_mandir %{_prefix}/share/man
|
|
|
|
%_sysconfdir /etc
|
|
|
|
%_localstatedir /var
|
|
|
|
%_defaultdocdir %{_usr}/share/doc/packages
|
2017-11-17 14:05:05 +01:00
|
|
|
%_fillupdir %{_usr}/share/fillup-templates
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# package build macros
|
2009-10-23 17:57:01 +02:00
|
|
|
%make_install make install DESTDIR=%{?buildroot}
|
2008-01-19 17:15:33 +01:00
|
|
|
%makeinstall make DESTDIR=%{?buildroot:%{buildroot}} install
|
|
|
|
%insserv_prereq insserv sed
|
|
|
|
%fillup_prereq fillup coreutils grep diffutils
|
2006-12-19 00:17:44 +01:00
|
|
|
%install_info_prereq info
|
|
|
|
|
2011-12-11 22:58:21 +01:00
|
|
|
# this script calls all scripts in /usr/lib/rpm/brp-suse.d
|
2011-12-12 12:02:26 +01:00
|
|
|
%__os_install_post \
|
|
|
|
/usr/lib/rpm/brp-compress \
|
|
|
|
/usr/lib/rpm/brp-suse \
|
|
|
|
%{nil}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2016-05-02 13:51:23 +02:00
|
|
|
%restart_on_update() %{expand::%%service_del_postun %{?**}}
|
|
|
|
%stop_on_removal() %{expand:%%service_del_preun %{?**}}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# macro: %configure_kernel_source
|
|
|
|
#
|
|
|
|
#
|
|
|
|
%configure_kernel_source() \
|
|
|
|
if test -d /usr/src/linux ; then \
|
|
|
|
pushd /usr/src/linux \
|
|
|
|
test -f .config || cp arch/%_arch/defconfig.default .config \
|
|
|
|
yes "" | make oldconfig \
|
|
|
|
make dep \
|
|
|
|
popd \
|
|
|
|
fi \
|
|
|
|
%nil
|
|
|
|
|
|
|
|
%is_plus %(if test -f /.buildenv ; then source /.buildenv ; if [[ "$BUILD_BASENAME" == *+kde ]] ; then echo 1 ; else echo 0 ; fi ; else echo 0 ; fi)
|
|
|
|
|
2010-11-18 13:53:52 +01:00
|
|
|
%set_permissions(f:) \
|
|
|
|
if [ -x /usr/bin/chkstat ]; then \
|
|
|
|
/usr/bin/chkstat -n --set --system %{**} \
|
|
|
|
fi \
|
|
|
|
%nil
|
2008-01-19 17:15:33 +01:00
|
|
|
|
|
|
|
%verify_permissions(e:f:) \
|
2010-11-18 13:53:52 +01:00
|
|
|
/usr/bin/chkstat -n --warn --system %{**} 1>&2 \
|
2006-12-19 00:17:44 +01:00
|
|
|
%nil
|
2008-01-19 17:15:33 +01:00
|
|
|
|
2006-12-19 00:17:44 +01:00
|
|
|
%suse_update_libdir() \
|
|
|
|
if [ %_lib != lib ]; then \
|
|
|
|
for file in %{?*} ; do \
|
|
|
|
[ ! -e $file ] && echo "Error: $file does not exist!" && exit -1 \
|
|
|
|
[ -e $file.nolib64 ] && echo "Error: $file.nolib64 already exists!" && exit -1 \
|
|
|
|
cp $file $file.nolib64 \
|
|
|
|
echo "patching $file" \
|
|
|
|
sed -e "s,/lib\\\>,/%_lib,g" $file.nolib64 | sed -e "s,/%_lib/cpp,/lib/cpp,; s,/usr/%_lib/perl,/usr/lib/perl, ; s,/%_lib\\([\$-]\\),/lib\\1,g" > $file \
|
2011-12-19 17:02:05 +01:00
|
|
|
diff -u $file.nolib64 $file \
|
2006-12-19 00:17:44 +01:00
|
|
|
rm -f $file.nolib64 \
|
|
|
|
done; \
|
|
|
|
fi ; \
|
|
|
|
|
|
|
|
|
|
|
|
# macro: fillup_and_insserv
|
|
|
|
# do the fillup and insserv calls for postinstall
|
2017-11-17 14:05:05 +01:00
|
|
|
# options:
|
2006-12-19 00:17:44 +01:00
|
|
|
# -n (use first argument as name for fillup template filenames
|
|
|
|
# instead of package name)
|
|
|
|
# -f (skip fillup parts)
|
|
|
|
# -i (skip insserv parts)
|
|
|
|
# -y (default start-variable value to yes)
|
|
|
|
# Used only if X-UnitedLinux-Default-Enabled is not specified
|
|
|
|
# in the init script
|
|
|
|
# -Y (force_yes: always activate, discard setting before update)
|
|
|
|
# arguments:
|
|
|
|
# [if "-n" first argument as package name]
|
|
|
|
# Pairs of:
|
|
|
|
# main script name
|
|
|
|
# and
|
|
|
|
# name of (old) START variable (unless -s is given)
|
|
|
|
#
|
2010-09-09 14:31:22 +02:00
|
|
|
# template for variables into /etc/sysconfig/package:
|
2017-11-17 14:05:05 +01:00
|
|
|
# /usr/share/fillup-templates/sysconfig.package
|
2006-12-19 00:17:44 +01:00
|
|
|
%fillup_and_insserv(finpsyY) \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{-p:echo "-p option for fillup_and_insserv no longer supported (ever only used on SL8.0)"; exit 1;} \
|
|
|
|
%{-s:echo "STARTVAR for fillup_and_insserv no longer supported (rc.config is gone since SL8.0)"; exit 1;} \
|
|
|
|
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
|
|
|
%{-Y:FORCE_YES=1}%{!-Y:FORCE_YES=0} \
|
|
|
|
set -- %{?*} \
|
|
|
|
%{-n:PNAME=$1 ; shift }%{!-n:PNAME=%{name}} \
|
|
|
|
INSSRV_ARRAY="" \
|
|
|
|
while [ ${#*} -gt 0 ] ; do \
|
|
|
|
SCRIPTNAME=$1 \
|
|
|
|
shift \
|
|
|
|
SV_B='^### BEGIN INIT INFO' \
|
|
|
|
SV_E='^### END INIT INFO' \
|
|
|
|
SV_KW=Default-Enabled \
|
2010-09-09 14:31:22 +02:00
|
|
|
SV_VALUE=`sed -n -e "/$SV_B/,/$SV_E/{/^# [^[:space:]]*$SV_KW:[[:space:]]*\\([^[:space:]]*\\).*/s//\\1/p;}" < /etc/init.d/$SCRIPTNAME` \
|
2008-09-12 20:37:28 +02:00
|
|
|
test "$FORCE_YES" = "1" && SV_VALUE="yes" \
|
2008-08-21 17:44:07 +02:00
|
|
|
test -n "$SV_VALUE" || SV_VALUE=%{-y:"yes"}%{!-y:"no"} \
|
|
|
|
INSSRV_ARRAY="$INSSRV_ARRAY $SCRIPTNAME $SV_VALUE" \
|
|
|
|
done \
|
|
|
|
%{!-f: %{do_real_fillup}} \
|
|
|
|
%{!-i: %{add_start_if_needed $INSSRV_ARRAY } } \
|
|
|
|
%nil
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# do_real_fillup: internal macro
|
|
|
|
# this part really calls fillup for the appropriate files
|
|
|
|
#
|
|
|
|
%do_real_fillup() \
|
2017-11-17 14:05:05 +01:00
|
|
|
SYSC_TEMPLATE=%{_fillupdir}/sysconfig.$PNAME \
|
2017-11-20 11:51:33 +01:00
|
|
|
# If template not in new %{_fillupdir}, fallback to old TEMPLATE_DIR \
|
2017-11-17 14:05:05 +01:00
|
|
|
if [ ! -f $SYSC_TEMPLATE ] ; then \
|
|
|
|
TEMPLATE_DIR=/var/adm/fillup-templates \
|
|
|
|
SYSC_TEMPLATE=$TEMPLATE_DIR/sysconfig.$PNAME \
|
|
|
|
fi \
|
2006-12-19 00:17:44 +01:00
|
|
|
SD_NAME="" \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{sysc_fillup}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# add_start_if_needed: internally used by fillup_and_insserv
|
|
|
|
%add_start_if_needed() \
|
2008-08-21 17:44:07 +02:00
|
|
|
set -- %{?*} \
|
2006-12-19 00:17:44 +01:00
|
|
|
while [ ${#*} -gt 0 ] ; do \
|
|
|
|
SCRIPTNAME=$1 \
|
2008-08-21 17:44:07 +02:00
|
|
|
SV_VALUE=$2 \
|
2006-12-19 00:17:44 +01:00
|
|
|
shift 2 \
|
2008-08-21 17:44:07 +02:00
|
|
|
test -n "$SCRIPTNAME" -a -n "$SV_VALUE" || { echo "SCRIPTNAME or SV_VALUE unknown"; exit 1;} \
|
|
|
|
if test "$FIRST_ARG" = "1" -a "$SV_VALUE" = "no" ; then \
|
2010-09-09 14:31:22 +02:00
|
|
|
/sbin/insserv ${YAST_IS_RUNNING:+-f} -r /etc/init.d/$SCRIPTNAME \
|
2008-08-21 17:44:07 +02:00
|
|
|
elif test "$FIRST_ARG" = "1" -o "$FORCE_YES" = "1" ; then \
|
2010-09-09 14:31:22 +02:00
|
|
|
/sbin/insserv ${YAST_IS_RUNNING:+-f} /etc/init.d/$SCRIPTNAME \
|
2006-12-19 00:17:44 +01:00
|
|
|
fi \
|
2017-11-17 14:05:05 +01:00
|
|
|
done
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# macro: insserv_cleanup
|
|
|
|
%insserv_cleanup() \
|
2010-09-09 14:31:22 +02:00
|
|
|
/sbin/insserv /etc/init.d
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# macro: fillup_only
|
2008-08-21 17:44:07 +02:00
|
|
|
# do the fillup for sysconfig files
|
2006-12-19 00:17:44 +01:00
|
|
|
# template naming convention:
|
|
|
|
# .../fillup-templates/sysconfig.$NAME1[-$NAME2]
|
|
|
|
# NAME1: the name of the sysconfig-file
|
|
|
|
# NAME2: if needed (if more packages fill the
|
|
|
|
# same sysconfig file) the package name
|
|
|
|
# options:
|
|
|
|
# -n set sysconfig name manually
|
|
|
|
# -a use package name as $NAME2
|
|
|
|
# -s use second arg as package-name
|
|
|
|
# -d use a subdirectory of sysconfig
|
|
|
|
# (last arg as directory name)
|
|
|
|
%fillup_only(dans) \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{-n:PNAME=%{1}}%{!-n:PNAME=%{name}} \
|
|
|
|
%{-s:SUBPNAME=-%{2}}%{!-s:SUBPNAME=%{-a:-%{name}}} \
|
2017-11-17 14:05:05 +01:00
|
|
|
SYSC_TEMPLATE=%{_fillupdir}/sysconfig.$PNAME$SUBPNAME \
|
2017-11-20 11:51:33 +01:00
|
|
|
# If template not in new %{_fillupdir}, fallback to old TEMPLATE_DIR \
|
2017-11-17 14:05:05 +01:00
|
|
|
if [ ! -f $SYSC_TEMPLATE ] ; then \
|
|
|
|
TEMPLATE_DIR=/var/adm/fillup-templates \
|
|
|
|
SYSC_TEMPLATE=$TEMPLATE_DIR/sysconfig.$PNAME$SUBPNAME \
|
|
|
|
fi \
|
2006-12-19 00:17:44 +01:00
|
|
|
SD_NAME="" \
|
|
|
|
%{-d:%{-s:SD_NAME=%{3}/}%{!-s:SD_NAME=%{2}/}} \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{sysc_fillup} \
|
2008-01-19 17:15:33 +01:00
|
|
|
%nil
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# internal only: sysc_fillup
|
|
|
|
%sysc_fillup() \
|
2010-09-09 14:31:22 +02:00
|
|
|
if [ -x /bin/fillup ] ; then \
|
2006-12-19 00:17:44 +01:00
|
|
|
if [ -f $SYSC_TEMPLATE ] ; then \
|
2015-06-22 10:42:43 +02:00
|
|
|
echo "Updating /etc/sysconfig/$SD_NAME$PNAME ..." \
|
2010-09-09 14:31:22 +02:00
|
|
|
mkdir -p /etc/sysconfig/$SD_NAME \
|
|
|
|
touch /etc/sysconfig/$SD_NAME$PNAME \
|
|
|
|
/bin/fillup -q /etc/sysconfig/$SD_NAME$PNAME $SYSC_TEMPLATE \
|
2008-08-21 17:44:07 +02:00
|
|
|
fi \
|
|
|
|
else \
|
|
|
|
echo "ERROR: fillup not found. This should not happen. Please compare" \
|
2010-09-09 14:31:22 +02:00
|
|
|
echo "/etc/sysconfig/$PNAME and $TEMPLATE_DIR/sysconfig.$PNAME and" \
|
2008-08-21 17:44:07 +02:00
|
|
|
echo "update by hand." \
|
|
|
|
fi
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# macro: rename_sysconfig_variable
|
2008-08-21 17:44:07 +02:00
|
|
|
# as the name says, rename a variable in the file given with -f
|
2006-12-19 00:17:44 +01:00
|
|
|
%rename_sysconfig_variable(f:) \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{!-f:echo "missing argument for rename_sysconfig_variable"; exit 1; }%{-f:FILE=%{-f*}} \
|
|
|
|
if [ -f $FILE ] ; then \
|
|
|
|
sed -i -e "s/^%{1}=/%{2}=/" $FILE \
|
|
|
|
fi
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
# macro: remove_and_set
|
2008-08-21 17:44:07 +02:00
|
|
|
# remove variables from sysconfig.$NAME
|
2006-12-19 00:17:44 +01:00
|
|
|
# (both if existant) and set them in the environment
|
|
|
|
# for further handling in postinstall
|
|
|
|
# options: -n set package name
|
|
|
|
# -y default to yes if not found (otherwise no)
|
|
|
|
%remove_and_set(n:y) \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{-n:PNAME=%{-n*}}%{!-n:PNAME=%{name}} \
|
|
|
|
DEF_VAL=%{-y:"yes"}%{!-y:"no"} \
|
2017-11-17 14:05:05 +01:00
|
|
|
DEL_TEMPL=%{_fillupdir}/$PNAME.del \
|
2008-08-21 17:44:07 +02:00
|
|
|
rm -f $DEL_TEMPL \
|
|
|
|
for var in %{?*} ; do \
|
|
|
|
echo -e "#\\n$var=$DEF_VAL\\n" >> $DEL_TEMPL \
|
|
|
|
done \
|
2010-09-09 14:31:22 +02:00
|
|
|
if [ -f /etc/sysconfig/$PNAME ] ; then \
|
|
|
|
/bin/fillup -q -t -r -i -d "=" /etc/sysconfig/$PNAME $DEL_TEMPL /etc/sysconfig/$PNAME.deleted.$$ \
|
|
|
|
test -f /etc/sysconfig/$PNAME.new && mv /etc/sysconfig/$PNAME.new /etc/sysconfig/$PNAME \
|
2008-08-21 17:44:07 +02:00
|
|
|
fi \
|
2010-09-09 14:31:22 +02:00
|
|
|
for i in $DEL_TEMPL /etc/sysconfig/$PNAME.deleted.$$ ; do \
|
2008-08-21 17:44:07 +02:00
|
|
|
if [ -f $i ] ; then \
|
|
|
|
. $i \
|
|
|
|
rm -f $i \
|
|
|
|
fi \
|
|
|
|
done
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
%insserv_force_if_yast() \
|
2010-09-09 14:31:22 +02:00
|
|
|
/sbin/insserv ${YAST_IS_RUNNING:+-f} %{?*}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
%run_ldconfig /sbin/ldconfig
|
|
|
|
|
2015-10-24 12:42:35 +02:00
|
|
|
# for %post
|
2006-12-19 00:17:44 +01:00
|
|
|
%install_info(:-:) \
|
2008-08-21 17:44:07 +02:00
|
|
|
ALL_ARGS=(%{**}) \
|
|
|
|
NUM_ARGS=${#ALL_ARGS[@]} \
|
2010-09-09 14:31:22 +02:00
|
|
|
if test -x /sbin/install-info ; then \
|
2008-08-21 17:44:07 +02:00
|
|
|
if test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
|
2010-09-09 14:31:22 +02:00
|
|
|
/sbin/install-info "${ALL_ARGS[@]}" \
|
2008-08-21 17:44:07 +02:00
|
|
|
fi \
|
2017-11-17 14:05:05 +01:00
|
|
|
fi ;
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2015-10-24 12:42:35 +02:00
|
|
|
# for %preun
|
2006-12-19 00:17:44 +01:00
|
|
|
%install_info_delete(:-:) \
|
2015-10-24 12:42:35 +02:00
|
|
|
test -n "$FIRST_ARG" || FIRST_ARG=$1 \
|
2010-09-09 14:31:22 +02:00
|
|
|
if test -x /sbin/install-info ; then \
|
2015-10-24 12:42:35 +02:00
|
|
|
if [ "$FIRST_ARG" = 0 ]; then \
|
|
|
|
/sbin/install-info --quiet --delete %{**} \
|
2008-08-21 17:44:07 +02:00
|
|
|
fi ; \
|
2017-11-17 14:05:05 +01:00
|
|
|
fi ;
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2008-01-19 17:15:33 +01:00
|
|
|
# find-supplements.ksyms parses this macro directly out of the spec file:
|
|
|
|
%supplements_kernel_module() \
|
2008-08-21 17:44:07 +02:00
|
|
|
%{expand:%(if ! rpm -q kernel-syms > /dev/null; then echo "%fail Please add the kernel-syms package to BuildRequires"; fi)}
|
2008-01-19 17:15:33 +01:00
|
|
|
|
2013-11-28 11:41:40 +01:00
|
|
|
%suse_version @suse_version@
|
|
|
|
%sles_version @sles_version@
|
|
|
|
%ul_version @ul_version@
|
2016-05-31 14:02:53 +02:00
|
|
|
%is_opensuse @is_opensuse@
|
|
|
|
%leap_version @leap_version@
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
%do_profiling 1
|
2007-03-15 01:49:23 +01:00
|
|
|
%cflags_profile_generate -fprofile-generate
|
|
|
|
%cflags_profile_feedback -fprofile-use
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2008-11-28 16:19:38 +01:00
|
|
|
%suse_install_update_message() \
|
2008-12-02 15:49:45 +01:00
|
|
|
install -D -m 644 %1 %buildroot/var/adm/update-messages/%{name}-%{version}-%{release}-%(basename %1).txt \
|
|
|
|
%nil
|
|
|
|
|
2008-11-28 16:19:38 +01:00
|
|
|
%suse_install_update_script() \
|
2008-12-02 15:49:45 +01:00
|
|
|
install -D -m 755 %1 %buildroot/var/adm/update-scripts/%{name}-%{version}-%{release}-%(basename %1).txt \
|
|
|
|
%nil
|
2008-11-28 16:19:38 +01:00
|
|
|
|
2007-05-17 00:32:19 +02:00
|
|
|
# Template for lang sub-package.
|
2012-07-19 06:53:43 +02:00
|
|
|
%lang_package(n:r:) \
|
2007-08-09 12:29:08 +02:00
|
|
|
%package %{-n:-n %{-n*}-}lang \
|
2016-10-31 10:45:23 +01:00
|
|
|
Summary: Translations for package %{name} \
|
2007-08-09 12:29:08 +02:00
|
|
|
Group: System/Localization \
|
2007-08-31 18:48:05 +02:00
|
|
|
Requires: %{-n:%{-n*}}%{!-n:%{name}} = %{version} \
|
2012-07-19 06:53:43 +02:00
|
|
|
%{-r:Requires: %{-r*}} \
|
2007-09-13 18:38:33 +02:00
|
|
|
Provides: %{-n:%{-n*}}%{!-n:%{name}}-lang-all = %{version} \
|
2017-09-05 09:35:01 +02:00
|
|
|
Supplements: %{-n:%{-n*}}%{!-n:%{name}} \
|
2009-09-10 13:19:00 +02:00
|
|
|
BuildArch: noarch \
|
2007-08-09 12:29:08 +02:00
|
|
|
%description %{-n:-n %{-n*}-}lang \
|
2016-10-31 10:45:23 +01:00
|
|
|
Provides translations for the \"%{name}\" package.
|
2008-01-19 17:15:33 +01:00
|
|
|
|
2017-07-05 16:44:31 +02:00
|
|
|
# package version comparison macros
|
|
|
|
|
|
|
|
# compare two versions, returns -1, 0, 1, ~~~
|
|
|
|
%rpm_vercmp() %{lua:print(rpm.expand('%1') == '~~~' and '~~~' or rpm.vercmp(rpm.expand('%1'), rpm.expand('%2')))}
|
|
|
|
|
|
|
|
# expand to the installed version of a package/provides
|
|
|
|
%pkg_version() %(LC_ALL=C rpm -q --whatprovides --qf "%%{version}" "%1" | sed -e "s/^no package provides .*/~~~/")
|
|
|
|
|
|
|
|
# compare the installed version to a value. returns -1, 0, 1, ~~~
|
|
|
|
%pkg_version_cmp() %{expand:%{expand:%%%%{rpm_vercmp %%{pkg_version %1} %%2}}}
|
|
|
|
|
|
|
|
# convenience/readability
|
|
|
|
%pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0)
|
|
|
|
|