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
   216         kx #!/bin/sh
   216         kx 
   216         kx # Preserve new files
   216         kx install_file() {
   216         kx   NEW="$1"
   216         kx   OLD="`dirname $NEW`/`basename $NEW .new`"
   216         kx   # If there's no file by that name, mv it over:
   216         kx   if [ ! -r $OLD ]; then
   216         kx     mv $NEW $OLD
   216         kx   elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
   216         kx     rm $NEW
   216         kx   fi
   216         kx   # Otherwise, we leave the .new copy for the admin to consider...
   216         kx }
   216         kx 
   216         kx preserve_perms() {
   216         kx   NEW="$1"
   216         kx   OLD="$(dirname $NEW)/$(basename $NEW .new)"
   216         kx   if [ -e $OLD ]; then
   216         kx     cp -a $OLD ${NEW}.incoming
   216         kx     cat $NEW > ${NEW}.incoming
   216         kx     touch -r $NEW ${NEW}.incoming
   216         kx     mv ${NEW}.incoming $NEW
   216         kx   fi
   216         kx   install_file $NEW
   216         kx }
   216         kx 
   216         kx 
   216         kx # arg 1:  the new package version
   216         kx pre_install() {
   216         kx   /bin/true
   216         kx }
   216         kx 
   216         kx # arg 1:  the new package version
   216         kx post_install() {
   216         kx   install_file etc/grub.d/40_custom.new
   216         kx   rm -f etc/grub.d/40_custom.new
   216         kx   install_file etc/default/grub.new
   216         kx 
   216         kx   #
   216         kx   # NOTE:
   216         kx   #   'install-info' can work using relative paths and we can make use build machine
   216         kx   #   utility during installation to the some partition and use target 'install-info'
   216         kx   #   during installation directly on the running target machine.
   216         kx   #
   216         kx   if [ -x /usr/bin/install-info ] ; then
   216         kx     install-info --info-dir=usr/share/info usr/share/info/grub.info.gz     2>/dev/null
   216         kx     install-info --info-dir=usr/share/info usr/share/info/grub-dev.info.gz 2>/dev/null
   216         kx   elif ! grep "(grub)" usr/share/info/dir 1> /dev/null 2> /dev/null ; then
   216         kx   cat << EOF >> usr/share/info/dir
   216         kx 
   216         kx Kernel
   216         kx * grub-dev: (grub-dev).         The GRand Unified Bootloader Dev
   216         kx * grub-install: (grub)Invoking grub-install.
   216         kx                                 Install GRUB on your drive
   216         kx * grub-mkconfig: (grub)Invoking grub-mkconfig.
   216         kx                                 Generate GRUB configuration
   216         kx * grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
   216         kx * grub-mkrelpath: (grub)Invoking grub-mkrelpath.
   216         kx * grub-mkrescue: (grub)Invoking grub-mkrescue.
   216         kx                                 Make a GRUB rescue image
   216         kx * grub-mount: (grub)Invoking grub-mount.
   216         kx                                 Mount a file system using GRUB
   216         kx * grub-probe: (grub)Invoking grub-probe.
   216         kx                                 Probe device information
   216         kx * grub-script-check: (grub)Invoking grub-script-check.
   216         kx * GRUB: (grub).                 The GRand Unified Bootloader
   216         kx EOF
   216         kx   fi
   216         kx }
   216         kx 
   216         kx # arg 1:  the new package version
   216         kx # arg 2:  the old package version
   216         kx pre_update() {
   216         kx   /bin/true
   216         kx }
   216         kx 
   216         kx # arg 1:  the new package version
   216         kx # arg 2:  the old package version
   216         kx post_update() {
   216         kx   post_install
   216         kx }
   216         kx 
   216         kx # arg 1:  the old package version
   216         kx pre_remove() {
   216         kx   if [ -x /usr/bin/install-info ] ; then
   216         kx     install-info --delete --info-file=usr/share/info/grub-dev.info.gz --dir-file=usr/share/info/dir 2> /dev/null || /bin/true
   216         kx     install-info --delete --info-file=usr/share/info/grub.info.gz     --dir-file=usr/share/info/dir 2> /dev/null || /bin/true
   216         kx   fi
   216         kx }
   216         kx 
   216         kx # arg 1:  the old package version
   216         kx post_remove() {
   216         kx   /bin/true
   216         kx }
   216         kx 
   216         kx 
   216         kx operation=$1
   216         kx shift
   216         kx 
   216         kx $operation $*