Annotation of /trunk/mkinitrd-magellan/busybox/applets/install.sh
Parent Directory | Revision Log
Revision 532 -
(hide annotations)
(download)
(as text)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1998 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1998 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | niro | 532 | #!/bin/sh |
2 | |||
3 | export LC_ALL=POSIX | ||
4 | export LC_CTYPE=POSIX | ||
5 | |||
6 | prefix=${1} | ||
7 | if [ -z "$prefix" ]; then | ||
8 | echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]" | ||
9 | exit 1; | ||
10 | fi | ||
11 | h=`sort busybox.links | uniq` | ||
12 | cleanup="0" | ||
13 | noclobber="0" | ||
14 | case "$2" in | ||
15 | --hardlinks) linkopts="-f";; | ||
16 | --symlinks) linkopts="-fs";; | ||
17 | --cleanup) cleanup="1";; | ||
18 | --noclobber) noclobber="1";; | ||
19 | "") h="";; | ||
20 | *) echo "Unknown install option: $2"; exit 1;; | ||
21 | esac | ||
22 | |||
23 | if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then | ||
24 | # get the target dir for the libs | ||
25 | # assume it starts with lib | ||
26 | libdir=$($CC -print-file-name=libc.so | \ | ||
27 | sed -n 's%^.*\(/lib[^\/]*\)/libc.so%\1%p') | ||
28 | if test -z "$libdir"; then | ||
29 | libdir=/lib | ||
30 | fi | ||
31 | |||
32 | mkdir -p $prefix/$libdir || exit 1 | ||
33 | for i in $DO_INSTALL_LIBS; do | ||
34 | rm -f $prefix/$libdir/$i || exit 1 | ||
35 | if [ -f $i ]; then | ||
36 | cp -a $i $prefix/$libdir/ || exit 1 | ||
37 | chmod 0644 $prefix/$libdir/$i || exit 1 | ||
38 | fi | ||
39 | done | ||
40 | fi | ||
41 | |||
42 | if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then | ||
43 | inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'` | ||
44 | sub_shell_it=` | ||
45 | cd "$prefix" | ||
46 | for d in usr/sbin usr/bin sbin bin ; do | ||
47 | pd=$PWD | ||
48 | if [ -d "$d" ]; then | ||
49 | cd $d | ||
50 | ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f | ||
51 | fi | ||
52 | cd "$pd" | ||
53 | done | ||
54 | ` | ||
55 | fi | ||
56 | |||
57 | rm -f $prefix/bin/busybox || exit 1 | ||
58 | mkdir -p $prefix/bin || exit 1 | ||
59 | install -m 755 busybox $prefix/bin/busybox || exit 1 | ||
60 | |||
61 | for i in $h ; do | ||
62 | appdir=`dirname $i` | ||
63 | mkdir -p $prefix/$appdir || exit 1 | ||
64 | if [ "$2" = "--hardlinks" ]; then | ||
65 | bb_path="$prefix/bin/busybox" | ||
66 | else | ||
67 | case "$appdir" in | ||
68 | /) | ||
69 | bb_path="bin/busybox" | ||
70 | ;; | ||
71 | /bin) | ||
72 | bb_path="busybox" | ||
73 | ;; | ||
74 | /sbin) | ||
75 | bb_path="../bin/busybox" | ||
76 | ;; | ||
77 | /usr/bin|/usr/sbin) | ||
78 | bb_path="../../bin/busybox" | ||
79 | ;; | ||
80 | *) | ||
81 | echo "Unknown installation directory: $appdir" | ||
82 | exit 1 | ||
83 | ;; | ||
84 | esac | ||
85 | fi | ||
86 | if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then | ||
87 | echo " $prefix$i -> $bb_path" | ||
88 | ln $linkopts $bb_path $prefix$i || exit 1 | ||
89 | else | ||
90 | echo " $prefix$i already exists" | ||
91 | fi | ||
92 | done | ||
93 | |||
94 | exit 0 |
Properties
Name | Value |
---|---|
svn:executable | * |