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 
     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   if [ -r sbin/init ]; then
     5         kx     mv sbin/init sbin/init.old
     5         kx   fi
     5         kx 
     5         kx   mv sbin/init.new sbin/init
     5         kx 
     5         kx   # Add a btmp file to store login failure if one doesn't exist:
     5         kx   if [ ! -r var/log/btmp ]; then
     5         kx     ( cd var/log ; umask 077 ; touch btmp )
     5         kx   fi
     5         kx 
     5         kx   # Notice we use an absolute path below, rather than usr/bin/last. This is because
     5         kx   # we're testing to see if we are on the bootdisk, which will not have /usr/bin/last.
     5         kx   # If we aren't, we will signal init to restart using the new binary.
     5         kx   # The presence of "/etc/system-installer" is under consideration as a better test.
     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/last ]; then
     5         kx     /sbin/init u
     5         kx   fi
     5         kx 
     5         kx   ( cd sbin ; rm -rf telinit )
     5         kx   ( cd sbin ; ln -sf init telinit )
     5         kx   ( cd sbin ; rm -rf reboot )
     5         kx   ( cd sbin ; ln -sf halt reboot )
     5         kx   ( cd sbin ; rm -rf poweroff )
     5         kx   ( cd sbin ; ln -sf halt poweroff )
     5         kx 
     5         kx   rm -f sbin/init.old
     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 $*