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
#!/bin/sh

# Preserve new files
install_file() {
  NEW="$1"
  OLD="`dirname $NEW`/`basename $NEW .new`"
  # If there's no file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
    # toss the redundant copy:
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}


# arg 1:  the new package version
pre_install() {
  /bin/true
}

# arg 1:  the new package version
post_install() {
  # Keep same perms on rc.serial.new:
  if [ -e etc/rc.d/rc.serial ]; then
    cp -a etc/rc.d/rc.serial etc/rc.d/rc.serial.new.incoming
    cat etc/rc.d/rc.serial.new > etc/rc.d/rc.serial.new.incoming
    mv etc/rc.d/rc.serial.new.incoming etc/rc.d/rc.serial.new
  fi

  install_file etc/rc.d/rc.serial.new
  install_file etc/rc.d/rc.setterm.new
  install_file etc/serial.conf.new

  for cfgfile in chfn.new chsh.new login.new runuser.new runuser-l.new su.new su-l.new ; do
    if [ -r etc/pam.d/$cfgfile ]; then
      install_file etc/pam.d/$cfgfile
    fi
  done

  if [ -r etc/default/su.new ]; then
    install_file etc/default/su.new
  fi


  # We use an relative path to 'proc/sys/kernel/osrelease' because we have to be sure
  # that we are running on the target platform. Only in this case we will use
  # absolute path to coreutils ('/bin/chgrp' and '/bin/chmod') and we have to check
  # is the coreutils already installed.
  if [ -r proc/sys/kernel/osrelease -a -x /bin/chgrp -a -x /bin/chmod ]; then
    /bin/chgrp tty /usr/bin/wall
    /bin/chmod g+s /usr/bin/wall
    /bin/chgrp tty /usr/bin/write
    /bin/chmod g+s /usr/bin/write
  fi
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_update() {
  /bin/true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_update() {
  post_install
}

# arg 1:  the old package version
pre_remove() {
  /bin/true
}

# arg 1:  the old package version
post_remove() {
  /bin/true
}


operation=$1
shift

$operation $*