Browse Source

updated vbuilder.sh.in: dropped user_from_uid()

git-svn-id: http://trac.vinelinux.org/repos/projects/vbootstrap/trunk@3343 ec354946-7b23-47d6-9f5a-488ba84defc7
munepi 13 years ago
parent
commit
4bd2e161fe
2 changed files with 19 additions and 27 deletions
  1. 5 1
      vbootstrap-vl.spec
  2. 14 26
      vbuilder.sh.in

+ 5 - 1
vbootstrap-vl.spec

@@ -1,7 +1,7 @@
 # This package is maintained on trac svn repository. Please do not change on local.
 # If you find a BUG, please report to Vine@vinelinux.org or mailing list or BTS.
 
-%define version 0.0.40
+%define version 0.0.41
 
 Summary: bootstrap scripts to create a basic Vine Linux system
 Summary(ja): Vine Linux の基本システムを作成するためのスクリプト
@@ -80,6 +80,10 @@ vbuilder は vbootstrap を利用して chroot 環境の構築し、
 
 
 %changelog
+* Xxx Xxx XX XXXX Munehiro Yamamoto <munepi@vinelinux.org> 0.0.41-1
+- updated vbuilder.sh.in
+  - dropped user_from_uid()
+
 * Sun Mar 20 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.40-1
 - updated vbuilder.sh.in
   - arranged some procedures to mount /proc and unionfs_dir 

+ 14 - 26
vbuilder.sh.in

@@ -116,6 +116,20 @@ check-next-parameter(){
 }
 
 setup-vbuilder(){
+    ## check $SUDO_USER and $USERHELPER_UID
+    RPM_SIGN_USER=$SUDO_USER
+    if [ -z "${RPM_SIGN_USER}" ]; then
+	local entries=$(getent passwd $USERHELPER_UID)
+	if [ $? -eq 0 ]; then
+	    RPM_SIGN_USER=$(echo $entries | cut -d":" -f3)
+	else
+	    echo $"W: \$SUDO_USER and \$USERHELPER_UID are empty"
+	    return 1
+	fi
+    fi
+    ## get $RPM_SIGN_USER's home directory
+    HOME=$(getent passwd $RPM_SIGN_USER |  cut -d":" -f6)
+
     ## load default settings
     VBUILDER_CONF=/etc/vbootstrap/vbuilder.conf
     if [ -r $VBUILDER_CONF ]; then
@@ -518,22 +532,6 @@ EOF
     return 0
 }
 
-## user_from_uid [uid]
-user_from_uid () {
-    ## check whether or not $1 is a number
-    ! echo $1 | egrep -q '[^0-9]' || return 1
-    
-    # look for the corresponding name in /etc/passwd
-    local IFS=":"
-    while read name x uid the_rest; do
-        [ "$1" = "$uid" ] && echo "$name" && return 0
-    done < /etc/passwd
-
-    # if nothing was found, return false
-    return 1
-}
-
-
 ##############################################################################
 
 Clean(){
@@ -785,16 +783,6 @@ RPM_Build(){
 RPM_Sign(){
     [ $with_sign -eq 1 ] || return 1
 
-    ## check $SUDO_USER and $USERHELPER_UID
-    local RPM_SIGN_USER=$SUDO_USER
-    if [ -z "${RPM_SIGN_USER}" ]; then
-	RPM_SIGN_USER=$(user_from_uid $USERHELPER_UID)
-	if [ -z "${RPM_SIGN_USER}" ]; then
-	    echo $"W: \$SUDO_USER and \$USERHELPER_UID are empty"
-	    return 1
-	fi
-    fi
-
     setup-vbootstrap || return 1
 
     [ -d ${BUILD_ROOT} ] || Build