diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2009-03-29 21:33:00 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2009-03-29 21:33:00 +0000 |
commit | 00ec14c0829f9a4edb277a7f33bbdcea7b1ee15f (patch) | |
tree | 6f26f37fbbfe78501231144f3ff666676296eba2 | |
parent | 7721d9064578296092c1bdd85ecfb85ee4e76fa6 (diff) | |
download | rpm-helper-0.22.0.tar rpm-helper-0.22.0.tar.gz rpm-helper-0.22.0.tar.bz2 rpm-helper-0.22.0.tar.xz rpm-helper-0.22.0.zip |
version 0.22.0v0.22.0
-rw-r--r-- | trunk/.cvsignore | 1 | ||||
-rw-r--r-- | trunk/AUTHORS | 4 | ||||
-rw-r--r-- | trunk/COPYING | 340 | ||||
-rw-r--r-- | trunk/Makefile | 58 | ||||
-rw-r--r-- | trunk/NEWS | 76 | ||||
-rw-r--r-- | trunk/README | 59 | ||||
-rwxr-xr-x | trunk/add-group | 44 | ||||
-rwxr-xr-x | trunk/add-service | 91 | ||||
-rwxr-xr-x | trunk/add-shell | 34 | ||||
-rwxr-xr-x | trunk/add-syslog | 235 | ||||
-rwxr-xr-x | trunk/add-user | 31 | ||||
-rwxr-xr-x | trunk/add-webapp | 15 | ||||
-rwxr-xr-x | trunk/create-file | 31 | ||||
-rwxr-xr-x | trunk/create-ssl-certificate | 74 | ||||
-rwxr-xr-x | trunk/del-group | 24 | ||||
-rwxr-xr-x | trunk/del-service | 27 | ||||
-rwxr-xr-x | trunk/del-shell | 37 | ||||
-rwxr-xr-x | trunk/del-syslog | 44 | ||||
-rwxr-xr-x | trunk/del-user | 22 | ||||
-rwxr-xr-x | trunk/del-webapp | 23 | ||||
-rwxr-xr-x | trunk/get-password | 11 | ||||
-rw-r--r-- | trunk/rpm-helper.macros.in | 67 | ||||
-rw-r--r-- | trunk/ssl | 12 | ||||
-rwxr-xr-x | trunk/verify-shell | 31 |
24 files changed, 1391 insertions, 0 deletions
diff --git a/trunk/.cvsignore b/trunk/.cvsignore new file mode 100644 index 0000000..9adf581 --- /dev/null +++ b/trunk/.cvsignore @@ -0,0 +1 @@ +*.tar.bz2 diff --git a/trunk/AUTHORS b/trunk/AUTHORS new file mode 100644 index 0000000..a0e7ac2 --- /dev/null +++ b/trunk/AUTHORS @@ -0,0 +1,4 @@ +Frédéric Lepied <flepied@mandriva.com> +Herton Ronaldo Krzesinski <herton@mandriva.com> +Thierry Vignaud <tvignaud@mandriva.com> +Guillaume Rousse <guillomovitch@mandriva.org> diff --git a/trunk/COPYING b/trunk/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/trunk/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/trunk/Makefile b/trunk/Makefile new file mode 100644 index 0000000..ea79498 --- /dev/null +++ b/trunk/Makefile @@ -0,0 +1,58 @@ +PACKAGE = rpm-helper +VERSION = 0.22.0 +SVNPATH = svn+ssh://svn.mandriva.com/svn/soft/rpm/$(PACKAGE) + +SCRIPT_FILES = add-user del-user add-service del-service create-file \ + add-group del-group add-shell del-shell verify-shell \ + add-syslog del-syslog add-webapp del-webapp \ + get-password create-ssl-certificate +MACROS_FILES = rpm-helper.macros +CONF_FILES = ssl +FILES = AUTHORS README COPYING NEWS Makefile \ + $(SCRIPT_FILES) $(MACROS_FILES:=.in) $(CONF_FILES) + +pkgdatadir = /usr/share/$(PACKAGE) +rpmmacrosdir = /etc/rpm/macros.d +sysconfigdir = /etc/sysconfig + +all: + @echo "use make install or make dist" + +install: $(MACROS_FILES) + install -d -m 755 $(DESTDIR)$(pkgdatadir) + cp -p $(SCRIPT_FILES) $(DESTDIR)$(pkgdatadir) + install -d -m 755 $(DESTDIR)$(rpmmacrosdir) + install -m 644 $(MACROS_FILES) $(DESTDIR)/$(rpmmacrosdir) + install -d -m 755 $(DESTDIR)$(sysconfigdir) + install -m 644 $(CONF_FILES) $(DESTDIR)/$(sysconfigdir) + +rpm-helper.macros: rpm-helper.macros.in + sed -e 's:@pkgdatadir@:$(pkgdatadir):' < $< > $@ + +clean: + rm -f *~ + +# rules to build a local distribution + +localdist: cleandist dir localcopy tar + +cleandist: clean + rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.bz2 + +dir: + mkdir $(PACKAGE)-$(VERSION) + +localcopy: + tar c $(FILES) | tar x -C $(PACKAGE)-$(VERSION) + +tar: + tar cvf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION) + bzip2 -9vf $(PACKAGE)-$(VERSION).tar + rm -rf $(PACKAGE)-$(VERSION) + +# rules to build a public distribution + +dist: cleandist dir localcopy tar svntag + +svntag: + svn cp -m 'version $(VERSION)' $(SVNPATH)/trunk $(SVNPATH)/tags/v$(VERSION) diff --git a/trunk/NEWS b/trunk/NEWS new file mode 100644 index 0000000..1490f30 --- /dev/null +++ b/trunk/NEWS @@ -0,0 +1,76 @@ +2009-03-29 Guillaume Rousse <guillomovitch@mandriva.org> 0.22.0 + * do not silent stderr output (#48851) + * test user/group existence before creating them + * do not bypass certificate creation on package update, but + if key file already exists + +2008-04-02 Pixel <pixel@mandriva.com> 0.21.4 + + * workaround services "disabled" by default getting disabled on + upgrade (#39720) + +2008-03-14 Guillaume Rousse <guillomovitch@mandriva.org> 0.21.3 + * fix error in syslog-ng helper, and avoid spurious error + messages in output + +2008-02-14 Guillaume Rousse <guillomovitch@mandriva.org> 0.21.2 + * fix %_create-ssl-certificate args _correctly_ + +2008-02-05 Guillaume Rousse <guillomovitch@mandriva.org> 0.21.1 + * fix %_create-ssl-certificate args + +2008-01-27 Guillaume Rousse <guillomovitch@mandriva.org> 0.21.0 + * ssl certificate creation helper: + - rename macro to %_create-ssl-certificate, by + consistency with all other macros (except %create_ghost_file) + - change its interface to use switches for optional args + - use service name for certificate file, not package name + * document all helper macros in README + +2007-09-06 Guillaume Rousse <guillomovitch@mandriva.org> 0.20.0 + * ship a default configuration file for ssl certificate creation helpe + +2007-09-05 Guillaume Rousse <guillomovitch@mandriva.org> 0.19.2 + * ship a default configuration file for ssl certificate creation helpe + +2007-08-17 Guillaume Rousse <guillomovitch@mandriva.org> 0.19.1 + * fix usage of ssl certificate creation helper without 3rd argument + * allow local certificate configuration + +2007-06-29 Guillaume Rousse <guillomovitch@mandriva.org> 0.19.0 + * new ssl certificate creation helper + * renamed ChangeLog to NEWS + +2007-05-08 Herton Ronaldo Krzesinski <herton@mandriva.com> 0.18.5 + + * fixed deprecated chown syntax inside create-file and del-shell + usage inside rpm-helper.macros.in, reported by Vincent Danen on + ticket #30568 + * fixed my entry in AUTHORS file + +2007-03-07 Guillaume Rousse <guillomovitch@mandriva.org> 0.18.4 + + * revert to previous name for %create_ghostfile, as my attempt to + achieve compatibility failed + +2007-03-06 Guillaume Rousse <guillomovitch@mandriva.org> 0.18.3 + + * prefix all rpm macros with underscore for coherency + * really fix macros definitions, so as to be executed at installation, + not during build + * search for local pattern at the beginning of line in syslog.conf + * README files cleanup + * switch to a manual Changelog + +2007-03-05 Guillaume Rousse <guillomovitch@mandriva.org> 0.18.2 + + * fix rpm macros definitions + +2007-03-05 Guillaume Rousse <guillomovitch@mandriva.org> 0.18.1 + + * fix a typo in makefile preventing installation + +2007-03-05 Guillaume Rousse <guillomovitch@mandriva.org> 0.18 + + * new helper scripts: get-free-syslog-facility and get-password + * Makefile cleanup diff --git a/trunk/README b/trunk/README new file mode 100644 index 0000000..6988331 --- /dev/null +++ b/trunk/README @@ -0,0 +1,59 @@ +rpm-helper is a set of helper scripts to be executed at package installation +time. They are invocated through rpm macros. Here is a list of them, along with +their usage instructions. +rpm-helper is a set of scripts called by rpm scriptlets. + +%_get_password <length> +Return a random password from given length (default 8). + +%create_ghostfile <file> <owner> <group> <mode> +Create an empty file, with given owner, group and mode. + +%_create_ssl_certificate <name> [-g <group>] [-b] +Create a ssl key and certificate pair with given name under /etc/pki/tls. +Optional arguments: +-b: concatenate certificate with the key file (bundle mode) +-g: ensure key is readable by given group + +%_post_service <service> +Add given service to boot sequence, by running chkconfig --add on it. + +%_preun_service <service> +Remove given service from boot sequence, by running chkconfig --del on it. + +%_pre_useradd <name> <homedir> <shell> +Add given user, with given homedir and shell. + +%_postun_userdel <name> +Does nothing currently. + +%_pre_groupadd <group> [user1,user2,...] +Add given group, with optional list of coma-separated users as members. + +%_postun_groupdel <group> +Does nothing currently. + +%_post_shelladd <shell> +Add given shell to the list of available system shells. + +%_preun_shelldel <shell> +Remove given shell from the list of available system shells. + +%_post_syslogadd <destination> [-s <source>] [-f <facility>] [-m <min>] [-M <max>] +Add a syslog entry, with given destination (usually a log file), and returns +used facility. Support sysklogd and syslog-ng. +Optional arguments: +-s: ensure given source (usually /dev/log) is readable by syslog daemon. +-f: use given facility (otherwise first available local one is used). +-m: use given minimal priority. +-M: use given maximal priority. + +%_preun_syslogdel +Delete syslog entry created by previous macro. Support sysklogd and syslog-ng. + +%_post_webapp +Handle apache configuration reloading if needed when adding a web application. + +%_postun_webapp +Handle apache configuration reloading if needed when removing a web application. +Comments and new scripts welcome. diff --git a/trunk/add-group b/trunk/add-group new file mode 100755 index 0000000..ea9e920 --- /dev/null +++ b/trunk/add-group @@ -0,0 +1,44 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : add-group +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Mon Jul 29 15:07:28 2002 +# Purpose : helper script for rpm scriptlets to add a +# system group. +#--------------------------------------------------------------- + +if [ $# -lt 3 ]; then + echo "usage: $0 <pkg name> <num installed> <group name> [<user1>,<user2>...]" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +name=$3 # name of the group +users=$4 # users to add to this group + +if ! getent group $name /dev/null 2>&1; then + /usr/sbin/groupadd -r $name > /dev/null + + if [ -n "$users" ]; then + SAVED_IFS="$IFS" + export IFS="$IFS", + set $users + IFS="$SAVED_IFS" + + for u in $*; do + old=`egrep "[:,]$u(,|$)" /etc/group | cut -d : -f 1 | xargs echo` + if [ -n "$old" ]; then + old=`echo ",$old" | sed 's/ /,/g'` + fi + /usr/sbin/usermod -G $name$old $u > /dev/null + done + fi +fi + +exit 0 + +# add-group ends here diff --git a/trunk/add-service b/trunk/add-service new file mode 100755 index 0000000..f42907a --- /dev/null +++ b/trunk/add-service @@ -0,0 +1,91 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : add-service +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Mon Jul 8 08:14:34 2002 +# Purpose : helper script for rpm scriptlets to add a +# service. +#--------------------------------------------------------------- + +if [ $# != 3 ]; then + echo "usage: $0 <pkg name> <number installed> <service name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +srv=$3 # name of the service + +add_chkconfig_service() { + srv=$1 + + /sbin/chkconfig --add $srv + + if [ -r /etc/sysconfig/system ]; then + . /etc/sysconfig/system + fi + + if [ -z "$ADD_SERVICES_TO_CURRENT_PROFILE_ONLY" ]; then + # add the service to all the profiles at once + if [ -d /etc/netprofile/profiles/default/services ]; then + for dir in /etc/netprofile/profiles/*/services; do + touch $dir/$srv + done + fi + fi +} + +add_service() { + # Add the service + if [ -r /etc/sysconfig/msec ]; then + . /etc/sysconfig/msec + fi + + # High security: add only authorized services + LIST=/etc/security/msec/server + + # during the install the symlink isn't done so find the right file + # by ourselves + if [ -n "$DURING_INSTALL" -a ! -f $LIST ]; then + LIST=/etc/security/msec/server.$SECURE_LEVEL + fi + + if [ -f $LIST ]; then + if grep -q "^${srv}$" $LIST ; then + add_chkconfig_service $srv + fi + else + # Low security: install all the services + add_chkconfig_service $srv + fi +} + +if [ $num = 1 ]; then + # First install mode + add_service +else + # Upgrade mode + + # if the service is activated, add it again to be able to handle + # changes in start/stop levels + set -- /etc/rc3.d/S??$srv + if [ $# -gt 1 ]; then + echo 1>&2 "add-service: Error: $srv appears multiple times: $*" + fi + +# [FIXME] disabling code below for MDV2008.1 to workaround butchered services +# which have "chkconfig: - ..." and "Default-Start" dropped (#39720) +# if [ -f "$1" ]; then +# /sbin/chkconfig --add $srv +# fi + + # restart the service if already running + if [ -f /var/lock/subsys/$srv ]; then + /sbin/service $srv restart > /dev/null || : + fi +fi + +# add-service ends here diff --git a/trunk/add-shell b/trunk/add-shell new file mode 100755 index 0000000..2949063 --- /dev/null +++ b/trunk/add-shell @@ -0,0 +1,34 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : add-shell +# Version : $Id$ +# Author : Thierry Vignaud +# Created On : Tue Nov 5 13:52:20 2002 +# Purpose : helper script for rpm scriptlets to add a +# shell from /etc/shells +#--------------------------------------------------------------- + +if [ $# != 3 ]; then + echo "usage: $0 <pkg name> <number installed> <shell name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +shl=$3 # name of the shell + +CFG_FILE=/etc/shells + +# Create $CFG_FILE if needed +if [ ! -f $CFG_FILE ]; then + > $CFG_FILE +fi + +if ! grep -q "^$shl$" $CFG_FILE; then + (cat $CFG_FILE; echo "$shl") | sort | uniq > $CFG_FILE.new + mv -f $CFG_FILE.new $CFG_FILE +fi + +exit 0 diff --git a/trunk/add-syslog b/trunk/add-syslog new file mode 100755 index 0000000..c846218 --- /dev/null +++ b/trunk/add-syslog @@ -0,0 +1,235 @@ +#!/usr/bin/perl +# rpm helper scriptlet to add a syslog entry (sysklogd and syslog-ng) +# $Id$ +use Getopt::Std; +use strict; + +my %opts = ( + s => '/dev/log', + f => undef, + m => 'debug', + M => 'emerg' +); +getopts('s:f:m:M:', \%opts); +my ($source, $facility, $min, $max) = @opts{qw/s f m M/}; + +die <<EOF if @ARGV < 3; +usage: $0 [options] <pkg> <nb> <dest> +Available options: +-s <source> source (default: /dev/log) +-f <facility> facility (default: first local available) +-m <priority> min priority (default: debug) +-M <priority> max priority (default: emerg) +EOF +my ($package, $number, $dest) = @ARGV; + +# don't do anything for upgrade +exit(0) if $number == 2; + +# check arguments +my @facilities = qw/auth authpriv cron daemon \ + kern lpr mail mark news syslog \ + user uucp local0 local1 local2 \ + local3 local4 local5 local6 local7/; +my %facilities = map { $_ => 1 } @facilities; + +die "invalid facility '$facility'" if $facility && !$facilities{$facility}; + +my $i; +my @priorities = qw/debug info notice warning err crit alert emerg/; +my %priorities = map { $_ => $i++ } @priorities; + +die "invalid min priority '$min'" if $min && ! defined $priorities{$min}; +die "invalid max priority '$max'" if $max && ! defined $priorities{$max}; +die "maximum priority '$max' lower than minimum priority '$min'" + if $min && $max && ($priorities{$max} < $priorities{$min}); + +if (!$facility) { + my @local_facilities; + # parse all configuration files, and count occurences of local facilities + if (-f '/etc/syslog.conf') { + open(my $in, '<', '/etc/syslog.conf') + or die "Can't open /etc/syslog.conf for reading: $!"; + while (my $line = <$in>) { + $local_facilities[$1]++ if $line =~ /^local(\d)/; + } + close($in); + } + if (-f '/etc/syslog-ng.conf') { + open(my $in, '<', '/etc/syslog-ng.conf') + or die "Can't open /etc/syslog-ng.conf for reading: $!"; + while (my $line = <$in>) { + $local_facilities[$1]++ if $line =~ /facility\(local(\d)\)/; + } + close($in); + } + # use first facility without occurences + for my $i (1 .. 7) { + next unless $local_facilities[$i] == 0; + $facility = "local$i"; + last; + } + die "no available free facility" unless $facility; +} + +add_sysklogd_entry($package, $source, $dest, $facility, $min, $max) + if -f '/etc/syslog.conf'; + +add_syslogng_entry($package, $source, $dest, $facility, $min, $max) + if -f '/etc/syslog-ng.conf'; + +# output used facility as feedback +print $facility; + +sub add_sysklogd_entry { + my ($package, $source, $dest, $facility, $min, $max) = @_; + + # ensure source is configured + if ($source ne '/dev/log') { + my ($content, $changed); + open(my $in, '<', '/etc/sysconfig/syslog') + or die "Can't open /etc/sysconfig/syslog for reading: $!"; + while (my $line = <$in>) { + if ($line =~ /^SYSLOGD_OPTIONS=(["'])?(.*)\1/) { + my $quote = $1; + my $options = $2; + if ($options !~ /-a\s+$source/) { + $options .= " -a $source"; + $changed = 1; + } + $content .= + "SYSLOGD_OPTIONS=" . $quote . $options. $quote . "\n"; + } else { + $content .= $line; + } + } + close($in); + + if ($changed) { + open(my $out, '>', '/etc/sysconfig/syslog') + or die "Can't open /etc/sysconfig/syslog for writing: $!"; + print $out $content; + close($out); + } + } + + # compute selector + my $selector; + if ($max eq 'emerg') { + if ($min eq 'debug') { + $selector = "$facility.*"; + } else { + $selector = "$facility.$min"; + } + } else { + for my $i ($priorities{$min} .. $priorities{$max}) { + $selector .= ';' if $selector; + $selector .= "$facility.=$priorities[$i]"; + } + } + + # compute spacing to keep default configuration file formatting + my $tabs = length($selector) < 48 ? + ((48 - length($selector)) / 8) : + 1; + + # append entry + open(my $out, '>>', '/etc/syslog.conf') + or die "Can't open /etc/syslog.conf for appending: $!"; + print $out "# BEGIN: Automatically added by $package installation\n"; + print $out $selector . ("\t" x $tabs) . '-' . $dest . "\n"; + print $out "# END\n"; + close($out); + + # relaunch syslog + system('service syslog condrestart 2>&1 >/dev/null'); +} + +sub add_syslogng_entry { + my ($package, $source, $dest, $facility, $min, $max) = @_; + + # read it first to check its content + my ($source_id, $destination_id, $facility_id, $level_id); + my $level = $min eq $max ? $max : "$min..$max"; + open(my $fh, '<', '/etc/syslog-ng.conf') + or die "Can't open /etc/syslog-ng.conf for reading: $!"; + + while (my $line = <$fh>) { + if ($line =~ /^source \s+ (\S+) \s+ {/x) { + # source block + my $id = $1; + SOURCE: + while (1) { + if ($line =~ /(?:unix-stream|file) \s* \( (["']) ([^\1]+) \1/x) { + my $value = $2; + $source_id = $id if $source eq $value; + } + last SOURCE if $line =~ /};/; + $line = <$fh>; + last SOURCE if !$line; + } + } elsif ($line =~ /^destination \s+ (\S+) \s+ {/x) { + # destination block + my $id = $1; + DESTINATION: + while (1) { + if ($line =~ /file \s* \( (["']) ([^\1]+) \1/x) { + my $value = $2; + $destination_id = $id if $dest eq $value; + } + last DESTINATION if $line =~ /};/; + $line = <$fh>; + last DESTINATION if !$line; + } + } elsif ($line =~ /^filter \s+ (\S+) \s+ {/x) { + # filter block + my $id = $1; + FILTER: + while (1) { + if ($line =~ /facility \s* \( ([^)]+) \)/x) { + my $value = $1; + $facility_id = $id if $facility eq $value; + } + if ($line =~ /level \s* \( ([^)]+) \)/x) { + my $value = $1; + $level_id = $id if $level eq $value; + } + last FILTER if $line =~ /};/; + $line = <$fh>; + last FILTER if !$line; + } + } + } + close($fh); + + # then append what is needed + open(my $out, '>>', '/etc/syslog-ng.conf') + or die "Can't open /etc/syslog-ng.conf for appending: $!"; + + print $out "# BEGIN: Automatically added by $package installation\n"; + if (!$source_id) { + $source_id = 's_' . $package; + print $out "source $source_id { unix-stream('$source'); };\n"; + } + if (!$destination_id) { + $destination_id = 'd_' . $package; + print $out "destination $destination_id { file('$dest'); };\n"; + } + if (!$facility_id) { + $facility_id = 'f_facility_' . $package; + print $out "filter $facility_id { facility($facility); };\n"; + } + if (!$level_id) { + $level_id = 'f_level_' . $package; + print $out "filter $level_id { level($level); };\n"; + } + print $out "log { source($source_id);" . + " filter($facility_id);" . + " filter($level_id);" . + " destination($destination_id); };\n"; + print $out "# END\n"; + close($out); + + # relaunch syslog-ng + system('service syslog-ng condrestart 2>&1 >/dev/null'); +} diff --git a/trunk/add-user b/trunk/add-user new file mode 100755 index 0000000..4b761e2 --- /dev/null +++ b/trunk/add-user @@ -0,0 +1,31 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : add-user +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Mon Jul 8 08:14:34 2002 +# Purpose : helper script for rpm scriptlets to add a +# system user. +#--------------------------------------------------------------- + +if [ $# -lt 5 ]; then + echo "usage: $0 <pkg name> <num installed> <user name> <home dir> <shell>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +name=$3 # name of the user +dir=$4 # home directory +shell=$5 # shell + +if ! id $name /dev/null 2>&1; then + /usr/sbin/useradd -r -M \ + -s $shell -d $dir -c "system user for $pkg" $name > /dev/null +fi + +exit 0 + +# add-user ends here diff --git a/trunk/add-webapp b/trunk/add-webapp new file mode 100755 index 0000000..6468280 --- /dev/null +++ b/trunk/add-webapp @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ $# != 2 ]; then + echo "usage: $0 <pkg name> <number installed>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed + +if [ $num = 1 ]; then + # installation: restart web server if running, + # as there is a new configuration file + /sbin/service httpd condrestart +fi diff --git a/trunk/create-file b/trunk/create-file new file mode 100755 index 0000000..6ae3417 --- /dev/null +++ b/trunk/create-file @@ -0,0 +1,31 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : create-file +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Wed Jul 10 15:12:29 2002 +# Purpose : helper script for rpm scriptlets to create +# a non existent file. +#--------------------------------------------------------------- + +if [ $# != 6 ]; then + echo "usage: $0 <pkg name> <num installed> <file> <owner> <group> <mode>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +file=$3 # filename +owner=$4 # owner of the file +group=$5 # group of the file +mode=$6 # mode of the file + +if [ ! -f $file ]; then + touch $file + chown $owner:$group $file + chmod $mode $file +fi + +# create-file ends here diff --git a/trunk/create-ssl-certificate b/trunk/create-ssl-certificate new file mode 100755 index 0000000..954f187 --- /dev/null +++ b/trunk/create-ssl-certificate @@ -0,0 +1,74 @@ +#!/bin/sh +# $Id$ +# helper script for creating ssl certificates + +while [ $# -gt 0 ]; do + case $1 in + -g) group=$2; shift 2;; + -b) bundle="true"; shift;; + *) args=( ${args[@]:-} $1 ); shift;; + esac +done + +pkg=${args[0]} # name of the package +num=${args[1]} # number of packages installed +srv=${args[2]} # name of the service + +if [ -z "$pkg" -o -z "$num" -o -z "$srv" ]; then + echo "usage: $0 [-g <group>] [-b] <pkg name> <num installed> <service>" 1>&2 + exit 1 +fi + +if [ ! -f /etc/pki/tls/private/$srv.pem ]; then + # default values + host=$(hostname) + KEY_LENGTH=1024 + CERT_DAYS=365 + EMAIL_ADDRESS=root@$host + COMMON_NAME=$host + ORGANISATIONAL_UNIT_NAME="default $srv cert for $host" + + # source configuration + if [ -f /etc/sysconfig/ssl ]; then + . /etc/sysconfig/ssl + fi + + conffile=/tmp/$$ + keyfile=/etc/pki/tls/private/$srv.pem + if [ "$bundle" == true ]; then + certfile=$keyfile + else + certfile=/etc/pki/tls/certs/$srv.pem + fi + + # create a temporary configuration file + cat > $conffile <<EOF +default_bits = $KEY_LENGTH +encrypt_key = no +prompt = no +distinguished_name = req_dn +req_extensions = req_ext + +[ req_dn ] +commonName = $COMMON_NAME +organizationalUnitName = $ORGANISATIONAL_UNIT_NAME +emailAddress = $EMAIL_ADDRESS + +[ req_ext ] +basicConstraints = CA:FALSE +EOF + + # generate certificates + openssl req -new -x509 -days $CERT_DAYS \ + -config $conffile \ + -keyout $keyfile \ + -out $certfile >/dev/null + + # enforce strict perms on key + if [ -n "$group" ]; then + chmod 640 $keyfile + chgrp $group $keyfile + else + chmod 600 $keyfile + fi +fi diff --git a/trunk/del-group b/trunk/del-group new file mode 100755 index 0000000..6949791 --- /dev/null +++ b/trunk/del-group @@ -0,0 +1,24 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : del-group +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Mon Jul 29 16:17:34 2002 +# Purpose : helper script for rpm scriptlets to remove a +# system group. +#--------------------------------------------------------------- + +if [ $# -lt 3 ]; then + echo "usage: $0 <pkg name> <num installed> <group name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +name=$3 # name of the group + +exit 0 + +# del-group ends here diff --git a/trunk/del-service b/trunk/del-service new file mode 100755 index 0000000..f13aea6 --- /dev/null +++ b/trunk/del-service @@ -0,0 +1,27 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : del-service +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Tue Jul 9 08:11:26 2002 +# Purpose : helper script for rpm scriptlets to remove a +# service. +#--------------------------------------------------------------- + +if [ $# != 3 ]; then + echo "usage: $0 <pkg name> <number installed> <service name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +srv=$3 # name of the service + +if [ $num = 0 ]; then + /sbin/service $srv stop > /dev/null || : + /sbin/chkconfig --del $srv +fi + +# del-service ends here diff --git a/trunk/del-shell b/trunk/del-shell new file mode 100755 index 0000000..baeee15 --- /dev/null +++ b/trunk/del-shell @@ -0,0 +1,37 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : del-shell +# Version : $Id$ +# Author : Thierry Vignaud +# Created On : Tue Nov 5 13:52:20 2002 +# Purpose : helper script for rpm scriptlets to remove a +# shell from /etc/shells. +#--------------------------------------------------------------- + +if [ $# != 3 ]; then + echo "usage: $0 <pkg name> <number installed> <shell name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +shl=$3 # name of the shell + +CFG_FILE=/etc/shells + +# Create $CFG_FILE if needed +if [ ! -f $CFG_FILE ]; then + > $CFG_FILE + exit 0 +fi + +if [ "$num" = 0 ]; then + if [ ! -x $shl ]; then + grep -v "^$shl$" < $CFG_FILE > $CFG_FILE.new + mv -f $CFG_FILE.new $CFG_FILE + fi +fi + +exit 0 diff --git a/trunk/del-syslog b/trunk/del-syslog new file mode 100755 index 0000000..185b6ae --- /dev/null +++ b/trunk/del-syslog @@ -0,0 +1,44 @@ +#!/usr/bin/perl +# rpm helper scriptlet to remove a syslog entry (sysklogd and syslog-ng) +# $Id$ +use strict; + +die <<EOF if @ARGV < 2; +usage: $0 <pkg> <nb> +EOF +my ($package, $number) = @ARGV; + +# don't do anything for upgrade +exit(0) if $number == 1; + +if (-f '/etc/syslog.conf') { + del_syslog_entry($package, '/etc/syslog.conf'); + system(qw/service syslog condrestart/); +} + +if (-f '/etc/syslog-ng.conf') { + del_syslog_entry($package, '/etc/syslog-ng.conf'); + system(qw/service syslog-ng condrestart/); +} + +sub del_syslog_entry { + my ($package, $file) = @_; + + my $content; + open(my $in, '<', $file) + or die "Can't open $file for reading: $!"; + while (my $line = <$in>) { + if ($line =~ /^# BEGIN: Automatically added by $package installation$/) { + while ($line = <$in>) { + last if $line =~ /^# END$/; + } + } else { + $content .= $line; + } + } + + open(my $out, '>', $file) + or die "Can't open $file for writing: $!"; + print $out $content; + close($out); +} diff --git a/trunk/del-user b/trunk/del-user new file mode 100755 index 0000000..5938c97 --- /dev/null +++ b/trunk/del-user @@ -0,0 +1,22 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : del-user +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Mon Jul 8 08:26:40 2002 +# Purpose : helper script for rpm scriptlets to remove a +# system user. +#--------------------------------------------------------------- + +if [ $# != 3 ]; then + echo "usage: $0 <pkg name> <num installed> <user name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +name=$3 # name of the user + +# del-user ends here diff --git a/trunk/del-webapp b/trunk/del-webapp new file mode 100755 index 0000000..ec407a8 --- /dev/null +++ b/trunk/del-webapp @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ $# != 2 ]; then + echo "usage: $0 <pkg name> <number installed>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed + +if [ $num = 0 ]; then + # in simultaneous removal scenario, web server may + # already have been removed + if [ -f /etc/init.d/httpd ]; then + # uninstallation: restart web server if running, + # a there is one less configuration file + /sbin/service httpd condrestart + fi +else + # update: just reload web server if running, + # as the number of configuration files didn't change + /sbin/service httpd condreload +fi diff --git a/trunk/get-password b/trunk/get-password new file mode 100755 index 0000000..caa783a --- /dev/null +++ b/trunk/get-password @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id$ +# helper script for rpm scriptlets to get a random password + +if [ -n "$1" ]; then + length=$1 +else + length=8 +fi + +perl -e "@c = (a..z,A..Z,0..9); print map { @c[rand @c] } 0..$length" diff --git a/trunk/rpm-helper.macros.in b/trunk/rpm-helper.macros.in new file mode 100644 index 0000000..8d07f8f --- /dev/null +++ b/trunk/rpm-helper.macros.in @@ -0,0 +1,67 @@ +# $Id$ + +%_rpm_helper_dir @pkgdatadir@ + +%_get_password_helper %_rpm_helper_dir/get-password +%_get_password() $(%_get_password_helper %{1}) + +%_create_ghostfile_helper %_rpm_helper_dir/create-file +%create_ghostfile() %_create_ghostfile_helper %{name} $1 %{1} %{2} %{3} %{4} \ +%{nil} + +%_create_ssl_certificate_helper %_rpm_helper_dir/create-ssl-certificate +%_create_ssl_certificate(bg:) %_create_ssl_certificate_helper %{name} $1 %{1} %{?-g:-g %{-g*}} %{?-b:-b} \ +%{nil} + +# initscripts macros +%_add_service_helper %_rpm_helper_dir/add-service +%_post_service() %_add_service_helper %{name} $1 %{1} \ +%{nil} + +%_del_service_helper %_rpm_helper_dir/del-service +%_preun_service() %_del_service_helper %{name} $1 %{1} \ +%{nil} + +%_add_user_helper %_rpm_helper_dir/add-user +%_pre_useradd() %_add_user_helper %{name} $1 %{1} %{2} %{3} \ +%{nil} + +%_del_user_helper %_rpm_helper_dir/del-user +%_postun_userdel() %_del_user_helper %{name} $1 %{1} \ +%{nil} + +%_add_group_helper %_rpm_helper_dir/add-group +%_pre_groupadd() %_add_group_helper %{name} $1 %{1} %{?2:%2} \ +%{nil} + +%_del_group_helper %_rpm_helper_dir/del-group +%_postun_groupdel() %_del_group_helper %{name} $1 %{1} \ +%{nil} + +%_add_shell_helper %_rpm_helper_dir/add-shell +%_post_shelladd() %_add_shell_helper %{name} $1 %{1} \ +%{nil} + +%_del_shell_helper %_rpm_helper_dir/del-shell +%_preun_shelldel() %_del_shell_helper %{name} $1 %{1} \ +%{nil} + +%_add_syslog_helper %_rpm_helper_dir/add-syslog +%_post_syslogadd(s:f:m:M:) \ +%_add_syslog_helper %{name} $1 %{1} %{?-s:-s %{-s*}} %{?-f:-f %{-f*}} %{?-m:-m %{-m*}} %{?-M:-M %{-M*}} \ +%{nil} + +%_del_syslog_helper %_rpm_helper_dir/del-syslog +%_preun_syslogdel() %_del_syslog_helper %{name} $1 \ +%{nil} + +# Web App dir + +%_add_webapp_helper %_rpm_helper_dir/add-webapp +%_post_webapp() %_add_webapp_helper %{name} $1 \ +%{nil} + +%_del_webapp_helper %_rpm_helper_dir/del-webapp +%_postun_webapp() %_del_webapp_helper %{name} $1 \ +%{nil} + diff --git a/trunk/ssl b/trunk/ssl new file mode 100644 index 0000000..9e03c04 --- /dev/null +++ b/trunk/ssl @@ -0,0 +1,12 @@ +# configuration file for create-ssl-certificate rpm scriptlet + +# key length +KEY_LENGTH=1024 + +# certificate duration +CERT_DAYS=365 + +# certificate values +EMAIL_ADDRESS=root@$host +COMMON_NAME=$host +ORGANISATIONAL_UNIT_NAME="default $srv cert for $host" diff --git a/trunk/verify-shell b/trunk/verify-shell new file mode 100755 index 0000000..3aeefe6 --- /dev/null +++ b/trunk/verify-shell @@ -0,0 +1,31 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : verify-shell +# Version : $Id$ +# Author : Thierry Vignaud +# Created On : Tue Nov 5 13:52:20 2002 +# Purpose : helper script for rpm scriptlets to check a +# shell is in /etc/shells +#--------------------------------------------------------------- + +if [ $# != 3 ]; then + echo "usage: $0 <pkg name> <number installed> <shell name>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +shl=$3 # name of the shell + +CFG_FILE=/etc/shells + + +echo -n "Looking for $shl in /etc/shells... " +if ! grep "^/bin/${shl}\$" /etc/shells > /dev/null; then + echo "missing" + echo "${shl} missing from /etc/shells" >&2 +else + echo "found" +fi |