Browse Source

Stefan Fiedler:


			
			
				rocklinux
			
			
		
Stefan Fiedler 19 years ago
parent
commit
d6c1db4777
4 changed files with 183 additions and 0 deletions
  1. +118
    -0
      package/base/postinstall/postinstall
  2. +13
    -0
      package/base/postinstall/postinstall-example.sh
  3. +11
    -0
      package/base/postinstall/postinstall.conf
  4. +41
    -0
      package/base/postinstall/postinstall.desc

+ 118
- 0
package/base/postinstall/postinstall

@ -0,0 +1,118 @@
#!/bin/bash
#
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/scripts/Build-Pkg
# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
#
# 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. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
# Helper functions
is_installed ()
{
if [ install_checks_true == 1 ]; then return 0; fi
[ -e "$1" ];
}
is_removed ()
{
if [ remove_checks_true == 1 ]; then return 0; fi
[ ! -e "$1" ];
}
all_installed () {
for N in /var/adm/postinstall/*-install.??????;
do
#echo $N
if [ ! -e "$N" ]; then return 0; fi
grep "$1" "$N" | cut -f2 -d' ' |
while read M; do
if is_installed "/$M"; then echo "/$M"; fi;
done
done | sort -u
}
all_removed () {
for N in /var/adm/postinstall/*-remove.??????;
do
if [ ! -e "$N" ]; then return 0; fi
grep "$1" "$N" | cut -f2 -d' ' |
while read M; do
if is_removed "/$M"; then echo "/$M"; fi;
done
done | sort -u
}
any_installed () {
if [ install_checks_true == 1 ]; then return 0; fi
# This is a hack. Simply returning 0 if a file is found does not work?!
if [ "`all_installed $1`" != "" ]; then return 0; else return 1; fi
}
any_removed () {
if [ remove_checks_true == 1 ]; then return 0; fi
# This is a hack. Simply returning 0 if a file is found does not work?!
if [ "`all_installed $1`" != "" ]; then return 0; else return 1; fi
}
install_checks_true=0
remove_checks_true=0
if [ "$1" == "-a" ]; then install_checks_true=1; shift; fi
if [ "$1" == "-r" ]; then remove_checks_true=1; shift; fi
if [ "$1" == "--help" ]; then
echo "Usage: $0 [ -a ] [ -r ] [ --help ]"
echo
echo " -a execute all postinstall actions"
echo " -r execute all postremove actions"
echo " --help show this help text"
echo
exit 0;
fi
# Backup postinstall scripts for postremove operation
all_installed "etc/postinstall/.*\.sh" | while read M;
do
echo "Creating backup of $M in /etc/postinstall/postremove/"
cp -af "$M" "/etc/postinstall/postremove/${M##*/}"
done
# Execute removed postinstall scripts
all_removed "etc/postinstall/.*\.sh" | while read M;
do
P="/etc/postinstall/postremove/${M##*/}"
if [ -e $P ]; then
echo "Executing postremove script $P"
. "$P"
rm -f "$P"
else
echo "WARNING: backup of $M not found in /etc/postinstall/postremove"
fi
done
# Source postinstall scripts
for N in /etc/postinstall/*.sh;
do
echo "Executing postinstall script $N"
. "$N"
done
# Remove the postinstall/postremove logs
rm -f /var/adm/postinstall/*-{install,remove}.??????

+ 13
- 0
package/base/postinstall/postinstall-example.sh

@ -0,0 +1,13 @@
#! /bin/bash
if any_installed ".*\.so"; then
echo "dynamic libraries installed, run ldconfig!"
fi
if any_removed ".*\.so"; then
echo "dynamic libraries removed, run ldconfig!"
fi
all_installed ".*" | while read M; do echo "Installed: $M"; done
all_removed ".*" | while read M; do echo "Removed: $M"; done

+ 11
- 0
package/base/postinstall/postinstall.conf

@ -0,0 +1,11 @@
postinstall_main ()
{
mkdir -p /var/adm/postinstall
mkdir -p /etc/postinstall
mkdir -p /etc/postinstall/postremove
cp -a /$confdir/postinstall /usr/sbin/
chmod +x /usr/sbin/postinstall
cp -a /$confdir/postinstall-example.sh /etc/postinstall
}
mainfunction=postinstall_main

+ 41
- 0
package/base/postinstall/postinstall.desc

@ -0,0 +1,41 @@
[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN ---
[COPY]
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch.
[COPY] Please add additional copyright information _after_ the line containing
[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
[COPY]
[COPY] ROCK Linux: rock-src/package/base/psmisc/psmisc.desc
[COPY] ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
[COPY]
[COPY] This program is free software; you can redistribute it and/or modify
[COPY] it under the terms of the GNU General Public License as published by
[COPY] the Free Software Foundation; either version 2 of the License, or
[COPY] (at your option) any later version. A copy of the GNU General Public
[COPY] License can be found at Documentation/COPYING.
[COPY]
[COPY] Many people helped and are helping developing ROCK Linux. Please
[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM
[COPY] file for details.
[COPY]
[COPY] --- ROCK-COPYRIGHT-NOTE-END ---
[I] runs post-install/-remove actions
[T] Some packages require actions to be performed after files have been
[T] installed or removed.
[T] postinstall is used to execute the postinstall scripts that every
[T] package can supply.
[A] Stefan Fiedler <stefan dot fiedler at students dot jku dot ac>
[M] Stefan Fiedler <stefan dot fiedler at students dot jku dot ac>
[C] base/tool
[F] CORE
[L] OpenSource
[S] Stable
[V] 0.1
[P] X -?-3-----9 186.900

Loading…
Cancel
Save