Changeset 2571

Show
Ignore:
Timestamp:
05/20/07 17:01:35 (2 years ago)
Author:
n0-1
Message:

consolidate scripts/instprep-{rb,wrap,brcm}.sh together into scripts/instprep.sh

Actually, these files weren't different at all. Next point is makenode() was
buggy, but in every version of the script, as copy-and-paste occurs often and
is generally harmful.
As it's no problem to have device nodes for non-existent directories (just
look at old static /dev's), the merge was almost only copy-and-paste again
(this means: please verify for correctness ;).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/scripts/instprep.sh

    r2358 r2571  
    55#       * Create initial set of device nodes. 
    66#       * Recursively change owner to root. 
    7 #       * Copy kernel to flash. 
     7#       * Copy kernel to flash. (for yaffs2) 
    88# 
    99 
     
    1111 
    1212ME="`basename $0`" 
     13MYDIR="`dirname $0`" 
    1314ID=`id -u` 
    1415 
    1516makenode() { # (mode,name,type,major,minor) 
    16         if [ -c $1 ]; then 
    17                 echo "skipping existing file \`$1'" 
     17        if [ -e $2 ]; then 
     18                echo "skipping existing file \`$2'" 
    1819        elif ! mknod -m $1 $2 $3 $4 $5; then 
    19                 echo "error creating file \`$1', aborting!" 
     20                echo "error creating file \`$2', aborting!" 
    2021                exit 1 
    2122        fi 
     
    3334[ "$ID" -ne 0 ] && { echo "You need to be root to run me!"; help_quit;} 
    3435 
    35 # check for myself in current dir 
    36 if [ ! -f "${PWD}/$ME" ]; then 
    37         cd `dirname $0` 
    38 fi 
     36# go to a defined place 
     37cd "$MYDIR" 
    3938 
    4039case $MYTARGET in 
    41  
    4240ext2-cf|nfs) 
    43 echo "creating device nodes" 
    44 makenode 0666 dev/null c 1 3 
    45 makenode 0666 dev/tty c 5 0 
    46 makenode 0622 dev/console c 5 1 
    47 makenode 0660 dev/cfa b 13 0 
    48 makenode 0660 dev/cfa1 b 13 1 
    49 makenode 0660 dev/cfa2 b 13 2 
     41        echo "creating device nodes" 
     42        makenode 0666 dev/null c 1 3 
     43        makenode 0666 dev/tty c 5 0 
     44        makenode 0622 dev/console c 5 1 
     45        # for rb 
     46        makenode 0660 dev/cfa b 13 0 
     47        makenode 0660 dev/cfa1 b 13 1 
     48        makenode 0660 dev/cfa2 b 13 2 
     49        # for wrap 
     50        makenode 0660 dev/hda b 3 0 
     51        makenode 0660 dev/hda1 b 3 1 
    5052;; 
    51  
    52 yaffs2) 
    53 echo "copying over device nodes" 
    54 cp -dpR /dev/null /dev/tty /dev/console /dev/mtd* dev/ 
    55 echo "copying over kernel" 
    56 if [ -b /dev/mtdblock0 ]; then 
    57         mount -t yaffs2 /dev/mtdblock0 mnt/ 
    58 elif [ -b /dev/mtdblock/0 ]; then 
    59         mount -t yaffs2 /dev/mtdblock/0 mnt/ 
    60 else 
    61         echo "device node for first flash partition not found!" 
    62         exit 1 
    63 fi 
    64 cp kernel mnt/kernel 
    65 umount mnt/ 
     53yaffs2) # rb only 
     54        echo "copying over device nodes" 
     55        cp -dpR /dev/null /dev/tty /dev/console /dev/mtd* dev/ 
     56        echo "copying over kernel" 
     57        if [ -b /dev/mtdblock0 ]; then 
     58                mount -t yaffs2 /dev/mtdblock0 mnt/ 
     59        elif [ -b /dev/mtdblock/0 ]; then 
     60                mount -t yaffs2 /dev/mtdblock/0 mnt/ 
     61        else 
     62                echo "device node for first flash partition not found!" 
     63                exit 1 
     64        fi 
     65        cp kernel mnt/kernel 
     66        umount mnt/ 
    6667;; 
    67  
    6868*) 
    69 echo "something is really going wrong here!" 
     69       echo "something is really going wrong here!" 
    7070;; 
    71  
    7271esac 
    7372 
     
    7574chown -R 0:0 * 
    7675 
    77 echo "fixing sticky bit of /tmp
     76echo "fixing /tmp permissions
    7877chmod 1777 tmp/ 
    7978 
  • trunk/freewrt/target/image/brcm/Makefile

    r2559 r2571  
    99KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) 
    1010 
    11 INSTPREPSCRIPT = instprep-brcm.sh 
     11INSTPREPSCRIPT = instprep.sh 
    1212ROOTFSTARBALL = $(FWRT_PREFIX)-$(DEVICE)-$(BOARD)-$(KERNEL)-$(FS).tar.gz 
    1313NFS_DOC_URL = https://www.freewrt.org/trac/wiki/Documentation/Filesystems/NFS 
  • trunk/freewrt/target/image/rb/Makefile

    r2406 r2571  
    99KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) 
    1010 
    11 INSTPREPSCRIPT = instprep-rb.sh 
     11INSTPREPSCRIPT = instprep.sh 
    1212ROOTFSTARBALL = $(FWRT_PREFIX)-$(DEVICE)-$(BOARD)-$(KERNEL)-$(FS).tar.gz 
    1313NFS_DOC_URL = https://www.freewrt.org/trac/wiki/Documentation/Filesystems/NFS 
     
    1717 
    1818instprep-script: 
    19         install -m 0755 $(TOPDIR)/scripts/$(INSTPREPSCRIPT) $(KDIR)/root/ 
    20         $(SED) 's/@@TARGET_FS@@/$(FS)/' $(KDIR)/root/$(INSTPREPSCRIPT) 
     19        install -m 0755 $(TOPDIR)/scripts/$(INSTPREPSCRIPT) $(KDIR)/root/instprep.sh 
     20        $(SED) 's/@@TARGET_FS@@/$(FS)/' $(KDIR)/root/instprep.sh 
    2121         
    2222kernel-install: 
  • trunk/freewrt/target/image/x86/Makefile

    r2362 r2571  
    99KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD) 
    1010 
    11 INSTPREPSCRIPT = instprep-wrap.sh 
     11INSTPREPSCRIPT = instprep.sh 
    1212ROOTFSTARBALL = $(FWRT_PREFIX)-$(DEVICE)-$(BOARD)-$(KERNEL)-$(FS).tar.gz 
    1313INITRAMFS = $(FWRT_PREFIX)-$(DEVICE)-$(BOARD)-$(KERNEL)-$(FS).gz 
     
    1717 
    1818instprep-script: 
    19         install -m 0755 $(TOPDIR)/scripts/$(INSTPREPSCRIPT) $(KDIR)/root/ 
    20         $(SED) 's/@@TARGET_FS@@/$(FS)/' $(KDIR)/root/$(INSTPREPSCRIPT) 
     19        install -m 0755 $(TOPDIR)/scripts/$(INSTPREPSCRIPT) $(KDIR)/root/instprep.sh 
     20        $(SED) 's/@@TARGET_FS@@/$(FS)/' $(KDIR)/root/instprep.sh 
    2121         
    2222kernel-install: