source: freewrt/scripts/instprep-wrap.sh@ 655dec8

Last change on this file since 655dec8 was edaa1d2, checked in by Waldemar Brodkorb <wbx@…>, 19 years ago

fix busybox and tmp permissions

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2407 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3# Prepare the RootFS for later use. Depending on
4# the chosen target device type, do some of the following:
5# * Create initial set of device nodes.
6# * Recursively change owner to root.
7
8MYTARGET=@@TARGET_FS@@
9
10ME="`basename $0`"
11ID=`id -u`
12
13makenode() { # (mode,name,type,major,minor)
14 if [ -c $1 ]; then
15 echo "skipping existing file \`$1'"
16 elif ! mknod -m $1 $2 $3 $4 $5; then
17 echo "error creating file \`$1', aborting!"
18 exit 1
19 fi
20}
21help_quit() { # ()
22 echo "Usage:"
23 echo "$ME"
24 echo
25 echo "Prepare the RootFS right after installation for later use."
26 echo "If you want to know better, look at the source."
27 exit 1
28}
29
30[ $# -gt 0 ] && { echo "Too many arguments!"; help_quit;}
31[ "$ID" -ne 0 ] && { echo "You need to be root to run me!"; help_quit;}
32
33# check for myself in current dir
34if [ ! -f "${PWD}/$ME" ]; then
35 cd `dirname $0`
36fi
37
38case $MYTARGET in
39
40ext2-cf)
41echo "creating device nodes"
42makenode 0666 dev/null c 1 3
43makenode 0666 dev/tty c 5 0
44makenode 0622 dev/console c 5 1
45makenode 0660 dev/hda b 3 0
46makenode 0660 dev/hda1 b 3 1
47;;
48
49*)
50echo "something is really going wrong here!"
51;;
52
53esac
54
55echo "recursively fixing ownership"
56chown -R 0:0 *
57echo "fixing busybox permissions"
58if [ -x bin/busybox ];then chmod 4755 bin/busybox;fi
59echo "fixing /tmp permissions"
60chmod 1777 tmp
61
62exit 0
63
Note: See TracBrowser for help on using the repository browser.