Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/applets/install.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 815 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 5  export LC_CTYPE=POSIX Line 5  export LC_CTYPE=POSIX
5    
6  prefix=${1}  prefix=${1}
7  if [ -z "$prefix" ]; then  if [ -z "$prefix" ]; then
8   echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"   echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--scriptwrapper]"
9   exit 1;   exit 1;
10  fi  fi
11  h=`sort busybox.links | uniq`  h=`sort busybox.links | uniq`
12    scriptwrapper="n"
13  cleanup="0"  cleanup="0"
14  noclobber="0"  noclobber="0"
15  case "$2" in  case "$2" in
16   --hardlinks) linkopts="-f";;   --hardlinks)     linkopts="-f";;
17   --symlinks)  linkopts="-fs";;   --symlinks)      linkopts="-fs";;
18   --cleanup)   cleanup="1";;   --scriptwrapper) scriptwrapper="y";swrapall="y";;
19   --noclobber) noclobber="1";;   --sw-sh-hard)    scriptwrapper="y";linkopts="-f";;
20   "")          h="";;   --sw-sh-sym)     scriptwrapper="y";linkopts="-fs";;
21   *)           echo "Unknown install option: $2"; exit 1;;   --cleanup)       cleanup="1";;
22     --noclobber)     noclobber="1";;
23     "")              h="";;
24     *)               echo "Unknown install option: $2"; exit 1;;
25  esac  esac
26    
27  if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then  if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
# Line 33  if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_I Line 37  if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_I
37   for i in $DO_INSTALL_LIBS; do   for i in $DO_INSTALL_LIBS; do
38   rm -f $prefix/$libdir/$i || exit 1   rm -f $prefix/$libdir/$i || exit 1
39   if [ -f $i ]; then   if [ -f $i ]; then
40   cp -a $i $prefix/$libdir/ || exit 1   cp -pPR $i $prefix/$libdir/ || exit 1
41   chmod 0644 $prefix/$libdir/$i || exit 1   chmod 0644 $prefix/$libdir/$i || exit 1
42   fi   fi
43   done   done
# Line 43  if [ "$cleanup" = "1" ] && [ -e "$prefix Line 47  if [ "$cleanup" = "1" ] && [ -e "$prefix
47   inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`   inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`
48   sub_shell_it=`   sub_shell_it=`
49   cd "$prefix"   cd "$prefix"
50   for d in usr/sbin usr/bin sbin bin ; do   for d in usr/sbin usr/bin sbin bin; do
51   pd=$PWD   pd=$PWD
52   if [ -d "$d" ]; then   if [ -d "$d" ]; then
53   cd $d   cd $d
# Line 52  if [ "$cleanup" = "1" ] && [ -e "$prefix Line 56  if [ "$cleanup" = "1" ] && [ -e "$prefix
56   cd "$pd"   cd "$pd"
57   done   done
58   `   `
59     exit 0
60  fi  fi
61    
62  rm -f $prefix/bin/busybox || exit 1  rm -f $prefix/bin/busybox || exit 1
63  mkdir -p $prefix/bin || exit 1  mkdir -p $prefix/bin || exit 1
64  install -m 755 busybox $prefix/bin/busybox || exit 1  install -m 755 busybox $prefix/bin/busybox || exit 1
65    
66  for i in $h ; do  for i in $h; do
67   appdir=`dirname $i`   appdir=`dirname $i`
68   mkdir -p $prefix/$appdir || exit 1   mkdir -p $prefix/$appdir || exit 1
69   if [ "$2" = "--hardlinks" ]; then   if [ "$scriptwrapper" = "y" ]; then
70   bb_path="$prefix/bin/busybox"   if [ "$swrapall" != "y" ] && [ "$i" = "/bin/sh" ]; then
71   else   ln $linkopts busybox $prefix$i || exit 1
72   case "$appdir" in   else
73   /)   rm -f $prefix$i
74   bb_path="bin/busybox"   echo "#!/bin/busybox" > $prefix$i
75   ;;   chmod +x $prefix/$i
76   /bin)   fi
77   bb_path="busybox"   echo " $prefix$i"
  ;;  
  /sbin)  
  bb_path="../bin/busybox"  
  ;;  
  /usr/bin|/usr/sbin)  
  bb_path="../../bin/busybox"  
  ;;  
  *)  
  echo "Unknown installation directory: $appdir"  
  exit 1  
  ;;  
  esac  
  fi  
  if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then  
  echo "  $prefix$i -> $bb_path"  
  ln $linkopts $bb_path $prefix$i || exit 1  
78   else   else
79   echo "  $prefix$i already exists"   if [ "$2" = "--hardlinks" ]; then
80     bb_path="$prefix/bin/busybox"
81     else
82     case "$appdir" in
83     /)
84     bb_path="bin/busybox"
85     ;;
86     /bin)
87     bb_path="busybox"
88     ;;
89     /sbin)
90     bb_path="../bin/busybox"
91     ;;
92     /usr/bin|/usr/sbin)
93     bb_path="../../bin/busybox"
94     ;;
95     *)
96     echo "Unknown installation directory: $appdir"
97     exit 1
98     ;;
99     esac
100     fi
101     if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then
102     echo "  $prefix$i -> $bb_path"
103     ln $linkopts $bb_path $prefix$i || exit 1
104     else
105     echo "  $prefix$i already exists"
106     fi
107   fi   fi
108  done  done
109    

Legend:
Removed from v.815  
changed lines
  Added in v.816