Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx #!/bin/sh
     5         kx 
     5         kx # Preserve new files
     5         kx install_file() {
     5         kx   NEW="$1"
     5         kx   OLD="`dirname $NEW`/`basename $NEW .new`"
     5         kx   # If there's no file by that name, mv it over:
     5         kx   if [ ! -r $OLD ]; then
     5         kx     mv $NEW $OLD
     5         kx   elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
     5         kx     rm $NEW
     5         kx   fi
     5         kx   # Otherwise, we leave the .new copy for the admin to consider...
     5         kx }
     5         kx 
     5         kx preserve_perms() {
     5         kx   NEW="$1"
     5         kx   OLD="$(dirname $NEW)/$(basename $NEW .new)"
     5         kx   if [ -e $OLD ]; then
     5         kx     cp -a $OLD ${NEW}.incoming
     5         kx     cat $NEW > ${NEW}.incoming
     5         kx     touch -r $NEW ${NEW}.incoming
     5         kx     mv ${NEW}.incoming $NEW
     5         kx   fi
     5         kx   install_file $NEW
     5         kx }
     5         kx 
     5         kx 
     5         kx # arg 1:  the new package version
     5         kx pre_install() {
     5         kx   /bin/true
     5         kx }
     5         kx 
     5         kx # arg 1:  the new package version
     5         kx post_install() {
     5         kx   # Make sure that the postfix user (UID 91, GID 91),
     5         kx   # and the postdrop group (GID 92) exist on this system:
     5         kx   if ! grep -q "^postfix:" etc/passwd ; then
     5         kx     echo "postfix:x:91:91:User for Postfix MTA:/dev/null:/bin/false" >> etc/passwd
     5         kx   fi
     5         kx   if ! grep -q "^postfix:" etc/group ; then
     5         kx     echo "postfix:x:91:" >> etc/group
     5         kx   fi
     5         kx   if ! grep -q "^postdrop:" etc/group ; then
     5         kx     echo "postdrop:x:92:" >> etc/group
     5         kx   fi
     5         kx 
     5         kx   find etc/postfix -type f -name '*.new' | while read new ; do
     5         kx     install_file $new
     5         kx   done
     5         kx 
     5         kx   preserve_perms etc/rc.d/rc.postfix.new
     5         kx   install_file etc/aliases.new
     5         kx 
     5         kx   ( cd etc/postfix ; ln -s ../aliases aliases )
     5         kx 
     5         kx   # Don't keep aliases.new. If it exists, the user already defined aliases.
     5         kx   rm -f etc/aliases.new
     5         kx 
     5         kx   # This is for backward compatibility with the old Sendmail package;
     5         kx   # some software might still expect to find the /usr/lib/sendmail link.
     5         kx   if [ ! -d usr/lib ]; then
     5         kx     mkdir -p usr/lib
     5         kx     ( cd usr/lib ; rm -f sendmail )
     5         kx     ( cd usr/lib ; ln -s ../sbin/sendmail sendmail)
     5         kx   fi
     5         kx 
     5         kx   # We have to check that we are not in the installer mode on the target system
     5         kx   # ("/etc/system-installer"), and we have to be sure that we are on the working system
     5         kx   # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
     5         kx   if [ -r proc/sys/kernel/osrelease -a ! -r /etc/system-installer ]; then
     5         kx     # No reason to keep these: upgrade-configuration will take care
     5         kx     # of merging changes needed to the existing files
     5         kx     rm -f /etc/postfix/main.cf.new /etc/postfix/master.cf.new
     5         kx   fi
     5         kx 
     5         kx   # The upgrade-configuration command will add any necessary new settings to
     5         kx   # existing config files (/etc/postfix/{main,master}.cf).  It won't hurt
     5         kx   # anything on a new install.
     5         kx   #
     5         kx   # Also we have to check that we are not in the installer mode on the target system
     5         kx   # ("/etc/system-installer"), and we have to be sure that we are on the working system
     5         kx   # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
     5         kx   if [ -r proc/sys/kernel/osrelease -a ! -r /etc/system-installer -a -x /usr/sbin/postfix ]; then
     5         kx     /usr/sbin/postfix upgrade-configuration 1> /dev/null 2> /dev/null
     5         kx   fi
     5         kx 
     5         kx   # Process /etc/aliases into a database:
     5         kx   #
     5         kx   # Also we have to check that we are not in the installer mode on the target system
     5         kx   # ("/etc/system-installer"), and we have to be sure that we are on the working system
     5         kx   # on the target hardware ("proc/sys/kernel/osrelease" - relative path).
     5         kx   if [ -r proc/sys/kernel/osrelease -a ! -r /etc/system-installer -a -x /usr/bin/newaliases ]; then
     5         kx     /usr/bin/newaliases 1> /dev/null 2> /dev/null
     5         kx   fi
     5         kx }
     5         kx 
     5         kx # arg 1:  the new package version
     5         kx # arg 2:  the old package version
     5         kx pre_update() {
     5         kx   /bin/true
     5         kx }
     5         kx 
     5         kx # arg 1:  the new package version
     5         kx # arg 2:  the old package version
     5         kx post_update() {
     5         kx   post_install
     5         kx }
     5         kx 
     5         kx # arg 1:  the old package version
     5         kx pre_remove() {
     5         kx   /bin/true
     5         kx }
     5         kx 
     5         kx # arg 1:  the old package version
     5         kx post_remove() {
     5         kx   /bin/true
     5         kx }
     5         kx 
     5         kx 
     5         kx operation=$1
     5         kx shift
     5         kx 
     5         kx $operation $*