Using and making optional packages available for NetBSD/Amiga ############################################################# (C) Hubert Feyrer, january 8th, 1996 Summary: ~~~~~~~~ This document describes how optional packages should be structured so they can be easily installed and removed. Furthermore, a method for simplifying the installation is introduced and hints on how to configure optional packages are included. 0) Contents ~~~~~~~~~~~ 0. Contents 1. Introduction 1.1 Format of packages 1.2 Accessing packages easily 1.3) Other things to do while installing packages 2. The installation process 2.1 Things done while installing 2.2 Things done while uninstalling 3. Configuring the installation process 4. A note on configuring packages 5. Future plans 6. Disclaimer & legal stuff 7. Availability 8. Final note 1) Introduction ~~~~~~~~~~~~~~~ As stated in an earlier posting, I'd like to see all optional packages reside in their own directory below one common directory (/usr/local). Packages are placed in subdirectories below /usr/local, with the directory name of the package giving name and version of the package, e.g. /usr/local/fvwm-1.23f, /usr/local/bash-1.14.1. 1.1) Format of packages ~~~~~~~~~~~~~~~~~~~~~~~ Below the package-directories, files are stored in the following subdirectories: - binaries: bin - formatted man-pages: man/cat[1-8] - unformatted man-pages: man/man[1-8] - misc files: etc - libraries: lib - includes: include - info-files: info Information for installing the package is provided in the subdirectory "install", namely as a script "install.sh" for installation and (recommended) "uninstall.sh" for removing the package. 1.2) Accessing packages easily ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Having several packages installed would force users to include serveral bin-directories into their $PATH, get unwieldly long $MANPATHs, ... To prevent this, files that are accessed by users are linked to some public directories below /usr/local. The directories used are exactly the same as the ones used inside the packages. Doing this has two advantages: - easy installation of packages - users have to include only one directory into their $PATH (/usr/local/bin), $MANPATH (/usr/local/man), ... This document is intended to describe a mechanism for making packages accessible via those public directories. 1.3) Other things to do while installing packages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are also some more things to handle when installing packages, namely: - installing X application defaults - making files setuid root - creating auxiliary directories (for more libraries, includes, ...) - Pre/Post-install scripts (not yet) 2) The installation process ~~~~~~~~~~~~~~~~~~~~~~~~~~~ I've written some shell scripts that should help installing optional (precompiled) packages on ones system by doing the things mentioned above. All one has to do to configure the installation is to set some variables in a (shell)script that will be uses for installation as well as de-installation. 2.1) Things done while installing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The "install.sh"-script does the following things while making a package publically available: a) If application defaults are to be installed, figure out the directory where to put them. The following directories are searched: - /usr/lib/X11/app-defaults - /usr/local/X11R6/lib/X11/app-defaults - /usr/X11R6/lib/X11/app-defaults - /usr/local/X11R5/lib/X11/app-defaults - /usr/X11R5/lib/X11/app-defaults - $BASE/X11R6/lib/X11/app-defaults - $BASE/X11R5/lib/X11/app-defaults (BASE is the directory below which packages are installed, usually /usr/local, but can be changed, although this is not recommended) If no directory can be found, the user will be prompted to insert on. b) Create /usr/local and additional directories (for includes, libraries, ...). c) Link files specified from /usr/local//bin to /usr/local/bin. Same for files in etc, lib, man/man[1-8], man/cat[1-8], info and include. Directories that do not exist will be created. d) Install X application defaults into the directory previously figured out. e) Set specified files setuid root. 2.2) Things done while uninstalling ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "uninstall.sh" performs the following tasks while removing the package from public directories: a) Find out directory for application defaults as described above. b) Remove files from public directories: bin, etc, lib, man/man[1-8], man/cat[1-8], info, include. After that, directories will be removed if they are empty. c) The X application default file is removed. d) Remove misc directories for libraries, etc. Please note: the package itself (/usr/local/) is *not* removed! 3) Configuring the installation process ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The two scripts "install.sh" and "uninstall.sh" are expected to be placed in a packages "install" subdirectory. This is also the place where the two scripts look for a file "package" which describes the package. The packag-file contains only definitions for some (environment) variables, namely: - BASE: Base of public directories. Defaults to "/usr/local" and should not be changed. - PKG: Absolute patch of the package, usually "$BASE/package-name". - BIN: Which files to link from $PKG/bin to $BASE/bin. Must be enclosed in "quotes" if more than one file is given (space-seperated). - ETC: Which files from $PKG/etc will be needed in $BASE/etc? (Note: You should compile in /usr/local/packagename as base for packages, not /usr/local. This way you won't have to link files into /usr/local/etc.) - LIB: Libraries of public interrest, relative to $PKG/lib. Additional libraries can be created by setting MISCDIRS (see below). - MAN1: which unformatted man-pages to link from $PKG/man/man1 to $BASE/man/man1 (including ".1"-suffix!). Descriptions for general commands go here. - MAN2: same as MAN1 (suffix: ".2"), just for system calls. - MAN3: same as MAN1 (suffix: ".3"), just for C libraries. - MAN4: same as MAN1 (suffix: ".4"), just for device drivers. - MAN5: same as MAN1 (suffix: ".5"), just for file formats. - MAN6: same as MAN1 (suffix: ".6"), just for games. - MAN7: same as MAN1 (suffix: ".7"), just for miscellaneous things that don't fit else where. - MAN8: same as MAN1 (suffix: ".8"), just for system administrative commands. - MAN9: same as MAN1 (suffix: ".9"), just for kernel internals - MANN: same as MAN1 (suffix: ".n"), just for more misc stuff - MANL: same as MAN1 (suffix: ".l"), just for local software - CAT1: which formatted man-pages to link from $PKG/man/cat1 to $BASE/man/cat1 (including ".0"-suffix!). Descriptions for general commands go here. - CAT2: same as CAT1 (suffix: ".0"), just for system calls. - CAT3: same as CAT1 (suffix: ".0"), just for C libraries. - CAT4: same as CAT1 (suffix: ".0"), just for device drivers. - CAT5: same as CAT1 (suffix: ".0"), just for file formats. - CAT6: same as CAT1 (suffix: ".0"), just for games. - CAT7: same as CAT1 (suffix: ".0"), just for miscellaneous things that don't fit else where. - CAT8: same as CAT1 (suffix: ".0"), just for system administrative commands. - CAT9: same as CAT1 (suffix: ".0"), just for kernel internals - CATN: same as CAT1 (suffix: ".0"), just for more misc stuff - CATL: same as CAT1 (suffix: ".0"), just for local software - INFO: files to link to $BASE/info. Modification of "$BASE/info/dir" should be done by some smart post-processing script (once these are implemented ;-). - APPDEF: Application default files, relative to $PKG, usually "lib/XApp.ad". Suffix ".ad" will be stripped in link. - INCLUDE: Files to link into $BASE/include, e.g. for libraries like readline. Additional subdirectories can be created by setting MISCDIRS. - SUIDROOT: Which files (relative to $PKG) to make setuid-root (just in case tar goofed some protections/ownerships). - MISCDIRS: Which additional directories to create under $BASE. Usually for grouping includes or libraries. 4.) A note on configuring packages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When compiling optional packages, make the base-directory "/usr/local/", not "/usr/local". By doing so you don't have to put every single file into public directories, but only the ones of interrest for users (usually binaries and man pages). 5.) Future plans ~~~~~~~~~~~~~~~~ There are some things I can think of that might be useful: - Pre/Post-install-scripts which will be run before/after the installation to backup files, etc. - Some smart script to edit config-files. Useful for adding info-files to the dir-file or think if one wants to install wu-ftpd: editing /etc/inetd.conf by hand. :-/ - Merge with the Solaris- and SunOS-port >:) 6.) Disclaimer & legal stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Use at your own risk. All rights reserved. I take no responsibility for nothing. This software may not be used in non-academic environment withour the autor's written permission. 7.) Availability ~~~~~~~~~~~~~~~~ I'll put this all together into a package "EasyInstall-1.4.tar.gz" and place it into /pub/NetBSD-Amiga/contrib on ftp.uni-regensburg.de. 8.) Final note ~~~~~~~~~~~~~~ Call for discussion! What do you think about all of this? Are the two scripts useful, will anyone use it? What can be improved? How about the method for detecting the appdef-dir? Are there any public directories I've missed? Tell me! Either via private email (hubert.feyrer@rz.uni-regensburg.de) or the NetBSD/amiga mailing list (amiga@netbsd.org). Enjoy, Hubert =============== Hubert Feyrer ============================================ Weekdays: Rennerstr. 19, D-93053 Regensburg, Tel. 0941/943-2905 Weekends: Bachstr. 40, D-84066 Mallersdorf, Tel. 08772/6084 Internet: hubert.feyrer@rz.uni-regensburg.de == IRC: hubertf ==========================================================================