Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | remove install as user |
| 2 | |
| 3 | Upstream-Status: Inappropriate [configuration] |
| 4 | |
| 5 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 6 | --- |
| 7 | include/buildmacros | 2 +- |
| 8 | include/install-sh | 95 ++++++++--------------------------------------------- |
| 9 | 2 files changed, 14 insertions(+), 83 deletions(-) |
| 10 | |
| 11 | diff --git a/include/buildmacros b/include/buildmacros |
| 12 | index 7a01880..0840d55 100644 |
| 13 | --- a/include/buildmacros |
| 14 | +++ b/include/buildmacros |
| 15 | @@ -30,7 +30,7 @@ OBJECTS = $(ASFILES:.s=.o) \ |
| 16 | $(LFILES:.l=.o) \ |
| 17 | $(YFILES:%.y=%.tab.o) |
| 18 | |
| 19 | -INSTALL = $(TOPDIR)/install-sh -o $(PKG_USER) -g $(PKG_GROUP) |
| 20 | +INSTALL = $(TOPDIR)/install-sh |
| 21 | |
| 22 | IMAGES_DIR = $(TOPDIR)/all-images |
| 23 | DIST_DIR = $(TOPDIR)/dist |
| 24 | diff --git a/include/install-sh b/include/install-sh |
| 25 | index c952a71..b9d66f7 100755 |
| 26 | --- a/include/install-sh |
| 27 | +++ b/include/install-sh |
| 28 | @@ -24,11 +24,11 @@ |
| 29 | # set set | yes yes |
| 30 | # |
| 31 | _usage() { |
| 32 | - echo "Usage: $prog [-o owner] [-g group] [-m mode] -d directory" |
| 33 | - echo "or $prog [-D] [-o owner] [-g group] [-m mode] file directory/file" |
| 34 | - echo "or $prog [-o owner] [-g group] [-m mode] file [file ...] directory" |
| 35 | + echo "Usage: $prog [-m mode] -d directory" |
| 36 | + echo "or $prog [-m mode] file directory/file" |
| 37 | + echo "or $prog [-m mode] file [file ...] directory" |
| 38 | echo "or $prog -S file target (creates \"target\" symlink)" |
| 39 | - echo "or $prog -T lt_arg [-o owner] [-g group] [-m mode] libtool.lai directory" |
| 40 | + echo "or $prog -T lt_arg [-m mode] libtool.lai directory" |
| 41 | echo "" |
| 42 | echo "The \$DIST_MANIFEST and \$DIST_ROOT environment variables affect the" |
| 43 | echo "behaviour of this command - see comments in the script." |
| 44 | @@ -38,32 +38,6 @@ _usage() { |
| 45 | exit 1 |
| 46 | } |
| 47 | |
| 48 | -_chown () |
| 49 | -{ |
| 50 | - _st=255 |
| 51 | - if [ $# -eq 3 ] ; then |
| 52 | - chown $1:$2 $3 |
| 53 | - _st=$? |
| 54 | - if [ $_st -ne 0 ] ; then |
| 55 | - if [ $REAL_UID != '0' ] ; then |
| 56 | - if [ ! -f $DIST_ROOT/.chown.quiet ] ; then |
| 57 | - echo '===============================================' |
| 58 | - echo Ownership of files under ${DIST_ROOT:-/} |
| 59 | - echo cannot be changed |
| 60 | - echo '===============================================' |
| 61 | - if [ -n "$DIST_ROOT" ] ; then |
| 62 | - touch $DIST_ROOT/.chown.quiet |
| 63 | - fi |
| 64 | - fi |
| 65 | - _st=0 |
| 66 | - fi |
| 67 | - fi |
| 68 | - fi |
| 69 | - |
| 70 | - return $_st |
| 71 | -} |
| 72 | - |
| 73 | - |
| 74 | _manifest () |
| 75 | { |
| 76 | echo $* | sed -e 's/\/\//\//g' >>${DIST_MANIFEST:-/dev/null} |
| 77 | @@ -77,9 +51,6 @@ Sflag=false |
| 78 | Tflag=false |
| 79 | DIRMODE=755 |
| 80 | FILEMODE=644 |
| 81 | -OWNER=`id -u` |
| 82 | -GROUP=`id -g` |
| 83 | -REAL_UID=$OWNER |
| 84 | |
| 85 | # default is to install and don't append manifest |
| 86 | INSTALL=true |
| 87 | @@ -94,24 +65,16 @@ MANIFEST=: |
| 88 | |
| 89 | if $INSTALL |
| 90 | then |
| 91 | - CP=cp; LN=ln; MKDIR=mkdir; CHMOD=chmod; CHOWN=_chown |
| 92 | + CP=cp; LN=ln; MKDIR=mkdir; CHMOD=chmod; |
| 93 | else |
| 94 | - CP=true; LN=true; MKDIR=true; CHMOD=true; CHOWN=true |
| 95 | + CP=true; LN=true; MKDIR=true; CHMOD=true; |
| 96 | fi |
| 97 | |
| 98 | -[ -n "$DIST_ROOT" -a $REAL_UID -ne 0 ] && CHOWN=true |
| 99 | - |
| 100 | -while getopts "Dcm:d:S:o:g:T:" c $* |
| 101 | +while getopts "Dcm:d:S:T:" c $* |
| 102 | do |
| 103 | case $c in |
| 104 | c) |
| 105 | ;; |
| 106 | - g) |
| 107 | - GROUP=$OPTARG |
| 108 | - ;; |
| 109 | - o) |
| 110 | - OWNER=$OPTARG |
| 111 | - ;; |
| 112 | m) |
| 113 | DIRMODE=`expr $OPTARG` |
| 114 | FILEMODE=$DIRMODE |
| 115 | @@ -146,18 +109,7 @@ then |
| 116 | # first usage |
| 117 | # |
| 118 | $MKDIR -p $dir |
| 119 | - status=$? |
| 120 | - if [ $status -eq 0 ] |
| 121 | - then |
| 122 | - $CHMOD $DIRMODE $dir |
| 123 | - status=$? |
| 124 | - fi |
| 125 | - if [ $status -eq 0 ] |
| 126 | - then |
| 127 | - $CHOWN $OWNER $GROUP $dir |
| 128 | - status=$? |
| 129 | - fi |
| 130 | - $MANIFEST d $DIRMODE $OWNER $GROUP ${dir#$DIST_ROOT} |
| 131 | + $MANIFEST d $DIRMODE ${dir#$DIST_ROOT} |
| 132 | elif $Sflag |
| 133 | then |
| 134 | # |
| 135 | @@ -203,7 +155,7 @@ then |
| 136 | install_name=$target/$solib |
| 137 | $CP $solib $install_name |
| 138 | status=$? |
| 139 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$solib ${install_name#$DIST_ROOT} |
| 140 | + $MANIFEST f $FILEMODE $HERE/$solib ${install_name#$DIST_ROOT} |
| 141 | break |
| 142 | fi |
| 143 | done |
| 144 | @@ -254,7 +206,7 @@ then |
| 145 | install_name=$target/$old_library |
| 146 | $CP $old_library $install_name |
| 147 | status=$? |
| 148 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$old_library ${install_name#$DIST_ROOT} |
| 149 | + $MANIFEST f $FILEMODE $HERE/$old_library ${install_name#$DIST_ROOT} |
| 150 | ;; |
| 151 | *) |
| 152 | echo "$prog: -T $lt_install invalid" |
| 153 | @@ -267,7 +219,6 @@ then |
| 154 | if [ $status -eq 0 ] |
| 155 | then |
| 156 | $CHMOD $FILEMODE $install_name |
| 157 | - $CHOWN $OWNER $GROUP $install_name |
| 158 | fi |
| 159 | ;; |
| 160 | esac |
| 161 | @@ -292,23 +243,10 @@ else |
| 162 | then |
| 163 | if [ -f $dir/$f ] |
| 164 | then |
| 165 | - $CHMOD $FILEMODE $dir/$f |
| 166 | - status=$? |
| 167 | - if [ $status -eq 0 ] |
| 168 | - then |
| 169 | - $CHOWN $OWNER $GROUP $dir/$f |
| 170 | - status=$? |
| 171 | - fi |
| 172 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f |
| 173 | + $MANIFEST f $FILEMODE $HERE/$f ${dir#$DIST_ROOT}/$f |
| 174 | else |
| 175 | $CHMOD $FILEMODE $dir |
| 176 | - status=$? |
| 177 | - if [ $status -eq 0 ] |
| 178 | - then |
| 179 | - $CHOWN $OWNER $GROUP $dir |
| 180 | - status=$? |
| 181 | - fi |
| 182 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$dir ${dir#$DIST_ROOT} |
| 183 | + $MANIFEST f $FILEMODE $HERE/$dir ${dir#$DIST_ROOT} |
| 184 | fi |
| 185 | fi |
| 186 | else |
| 187 | @@ -334,14 +272,7 @@ else |
| 188 | status=$? |
| 189 | if [ $status -eq 0 ] |
| 190 | then |
| 191 | - $CHMOD $FILEMODE $dir/$f |
| 192 | - status=$? |
| 193 | - if [ $status -eq 0 ] |
| 194 | - then |
| 195 | - $CHOWN $OWNER $GROUP $dir/$f |
| 196 | - status=$? |
| 197 | - fi |
| 198 | - $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f |
| 199 | + $MANIFEST f $FILEMODE $HERE/$f ${dir#$DIST_ROOT}/$f |
| 200 | fi |
| 201 | [ $status -ne 0 ] && break |
| 202 | done |
| 203 | -- |
| 204 | 1.8.1.2 |
| 205 | |