Browse Source

gettextlize の途中

git-svn-id: http://trac.vinelinux.org/repos/projects/vbootstrap/trunk@2516 ec354946-7b23-47d6-9f5a-488ba84defc7
munepi 13 years ago
parent
commit
0b81a97c8d
1 changed files with 35 additions and 170 deletions
  1. 35 170
      vbuilder.sh.in

+ 35 - 170
vbuilder.sh.in

@@ -1,7 +1,7 @@
 #!/bin/bash
 # -*- coding: utf-8-unix -*-
 
-Usage_C(){
+Usage(){
     cat<<EOF
 Usage:	$(basename $0) {--version [version]} {--arch [arch]} {--category [categories]} {--dist-upgrade} {--target [target]} {--with-compat32} {--rpmbuild-with [bcond_with]} {--sign} {--no-install} {--bootstrap-dir [directory]} {--cache-dir [directory]} {--built-rpms-dir [directory]} {clean|build|build-rpm [src.rpm]|install-rpm [arch.rpm|package]|remove-rpm [package]|show-info}
 
@@ -45,170 +45,28 @@ $(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*//)
 EOF
 }
 
-Usage_ja(){
-    Usage_C
-}
-
-Msg_MissingParameter_C(){
-    local para=$1
-    cat<<EOF
-E: Missing some parameters after ${para}
-EOF
-}
-
-Msg_MissingParameter_ja(){
-    local para=$1
-    cat<<EOF
-E: ${para} 以後のいくつかの引数に間違いがあります
-EOF
-}
-
-Msg_NoSuchCategoryExists_C(){
-    local para=$1
-    cat<<EOF
-E: No such category exists: $para
-EOF
-}
-
-Msg_NoSuchCategoryExists_ja(){
-    local para=$1
-    cat<<EOF
-E: そのようなカテゴリは存在しません: $para
-EOF
-}
-
-Msg_GiveNoMoreOptions_C(){
-    cat<<EOF
-E: You can give no more options after actions
-EOF
-}
-
-Msg_GiveNoMoreOptions_ja(){
-    cat<<EOF
-E: 動作の以後にオプションを与えられません
-EOF
-}
-
-Msg_GiveAtLeastOneAction_C(){
-    cat<<EOF
-E: You must give at least one action
-EOF
-}
-
-Msg_GiveAtLeastOneAction_ja(){
-    cat<<EOF
-E: 少なくとも1つの動作を与えなければなりません
-EOF
-}
-
-Msg_NoSupportVARCH_C(){
-    cat<<EOF
-E: arch ${VARCH} is NOT supported on $(uname -i)
-EOF
-}
-
-Msg_NoSupportVARCH_ja(){
-    cat<<EOF
-E: ${VARCH} アーキテクチャは $(uname -i) 上で非サポートです
-EOF
-}
-
-Msg_NoSupportVERSION_C(){
-    cat<<EOF
-E: ${VERSION} is NOT supported
-EOF
-}
-
-Msg_NoSupportVERSION_ja(){
-    cat<<EOF
-E: バージョン ${VERSION} は非サポートです
-EOF
-}
-
-Msg_NoSupportDistUpgradeVERSION_C(){
-    cat<<EOF
-E: version ${VERSION} does not support --dist-upgrade option
-EOF
-}
-
-Msg_NoSupportDistUpgradeVERSION_ja(){
-    cat<<EOF
-E: バージョン ${VERSION} では --dist-upgrade オプションはサポートされていません
-EOF
-}
-
-Msg_NoSupportTARGET_C(){
-    cat<<EOF
-E: rpm build target ${TARGET} is NOT supported
-EOF
-}
-
-Msg_NoSupportTARGET_ja(){
-    cat<<EOF
-E: rpm ビルドターゲット ${TARGET} はサポートされていません
-EOF
-}
-
-Msg_NotPackageName_C(){
-    local RPM_PKG=$1
-    cat<<EOF
-E: $RPM_PKG is not a package name
-EOF
-}
-
-Msg_NotPackageName_ja(){
-    local RPM_PKG=$1
-    cat<<EOF
-E: $RPM_PKG はパッケージ名でありません
-EOF
-}
-
-Msg_NotSourceRPM_C(){
-    local RPM_PKG=$1
-    cat<<EOF
-E: $RPM_PKG is not a source RPM package
-EOF
-}
-
-Msg_NotSourceRPM_ja(){
-    local RPM_PKG=$1
-    cat<<EOF
-E: $RPM_PKG はソース RPM パッケージでありません
-EOF
-}
-
-Msg_SUDO_USERisEmpty_C(){
-cat<<EOF
-W: \$SUDO_USER is empty
-EOF
-}
-
-Msg_SUDO_USERisEmpty_ja(){
-cat<<EOF
-W: \$SUDO_USER が空です
-EOF
-}
-
 ##############################################################################
 
 check-parameter(){
-    [ -z "$*" ] && Usage_$LOCALE && return 1
+    [ -z "$*" ] && Usage && return 1
 
     while [ ! -z "$*" ]; do
 	case $1 in
 	    --help|help)
-		Usage_$LOCALE
+		Usage
 		return 1
 		;;
 	    --version|--arch|--category|--target|--rpmbuild-with|--bootstrap-dir|--cache-dir|--built-rpms-dir)
 		[ $with_actions -eq 1 ] && \
-		    Msg_GiveNoMoreOptions_$LOCALE && return 1
+		    echo $"E: You can give no more options after actions" && \
+		    return 1
 		shift
 		check-next-parameter $1 || return 1
 		;;
 	    --dist-upgrade|--unionfs|--with-compat32|--sign|--no-install)
 		[ $with_actions -eq 1 ] && \
-		    Msg_GiveNoMoreOptions_$LOCALE && return 1
+		    echo $"E: You can give no more options after actions" && \
+		    return 1
 		;;
 	    --build-rpm|build-rpm|--install-rpm|install-rpm|--remove-rpm|remove-rpm)
 		with_actions=1
@@ -219,24 +77,24 @@ check-parameter(){
 		with_actions=1
 		;;
 	    *)
-		Msg_MissingParameter_$LOCALE $1
+		echo $"E: Missing some parameters after $1"
 		return 1
 		;;
 	esac
 	shift
     done
 
-    [ $with_actions -eq 0 ] && Msg_GiveAtLeastOneAction_$LOCALE && return 1
+    [ $with_actions -eq 0 ] && \
+	echo $"E: You must give at least one action" && return 1
 
     return 0
 }
 
 check-next-parameter(){
-    local arg=$1
-    [ -z "${arg}" ] && Msg_MissingParameter_$LOCALE ${arg} && return 1
+    [ -z "$1" ] && echo $"E: Missing some parameters after $1" && return 1
 
-    [ $(echo ${arg} | grep '^-') ] && \
-	Msg_MissingParameter_$LOCALE ${arg} && return 1
+    [ $(echo $1 | grep '^-') ] && \
+	echo $"E: Missing some parameters after $1" && return 1
 
     return 0
 }
@@ -305,18 +163,19 @@ setup-vbootstrap(){
 	    case "${VARCH}" in
 		i386|i686|x86_64)
 		    [ "$(uname -i)" = "ppc" ] && \
-			Msg_NoSupportVARCH_$LOCALE && return 1
+			echo $"E: arch ${VARCH} is NOT supported on $(uname -i)" && return 1
 		    ;;
 		ppc)
 		    [ "$(uname -i)" = "i386" -o "$(uname -i)" = "i686" -o "$(uname -i)" = "x86_64" ] && \
-			Msg_NoSupportVARCH_$LOCALE && return 1
+			echo $"E: arch ${VARCH} is NOT supported on $(uname -i)" && return 1
 		    ;;
 	    esac
 	fi
 
         ##!! 4.2 is NO support on VARCH=x86_64
 	if [ "${VERSION}" = "4.2" -a "${VARCH}" = "x86_64" ]; then
-	    Msg_NoSupportVERSION_${LOCALE} && return 1
+	    echo $"E: ${VERSION} is NOT supported"
+	    return 1
 	fi
 
 	## support i386 chroot on x86_64 below: 
@@ -326,13 +185,15 @@ setup-vbootstrap(){
 
         ## check support ${VERSION}
 	if [ -z "$(/usr/sbin/vbootstrap | sed -e s/^Usage:.*// -e s/^E:.*// | grep -m 1 ${VERSION})" ]; then
-	    Msg_NoSupportVERSION_$LOCALE && return 1
+	    echo $"E: ${VERSION} is NOT supported"
+	    return 1
 	fi
 
 	## check ${VERSION} equals VineSeed*, when with_dist_upgrade=1
 	if [ $with_dist_upgrade -eq 1 ]; then
 	    if [ "$(echo ${VERSION} | sed -e "s/\(VineSeed\).*/\1/")" != "VineSeed" ]; then 
-		Msg_NoSupportDistUpgradeVERSION_$LOCALE && return 1
+		echo $"E: version ${VERSION} does not support --dist-upgrade option"
+		return 1
 	    fi
 	fi
 
@@ -356,24 +217,24 @@ setup-vbootstrap(){
 		test)
                     ## "test" category only exists in VineSeed
 		    [ "${MAJOR_VERSION}" = "VineSeed" ] || \
-			Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
+			echo $"E: No such category exists: $cat" && return 1
 		    with_category_test=1
 		    ;;
 		proposed-updates)
                     ##!! "proposed-updates" category does not exist in 4.2
 		    [ "${MAJOR_VERSION}" = "4.2" ] && \
-			Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
+			echo $"E: No such category exists: $cat" && return 1
 
 		    with_category_proposed_updates=1
 		    ;;
 		security)
                     ## "security" category does not exist in VineSeed
 		    [ "${MAJOR_VERSION}" = "VineSeed" ] && \
-			Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
+			echo $"E: No such category exists: $cat" && return 1
 		    with_category_security=1
 		    ;;
 		*)
-		    Msg_NoSuchCategoryExists_$LOCALE ${cat} && return 1
+		    echo $"E: No such category exists: $cat" && return 1
 		    ;;
 	    esac
 	done
@@ -382,7 +243,8 @@ setup-vbootstrap(){
 	if [ ! -z "${TARGET}" ]; then
 	    RPM_TARGET_LIST="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
 	    if [ -z "$(echo $RPM_TARGET_LIST | grep $TARGET)" ]; then
-		Msg_NoSupportTARGET_$LOCALE && return 1
+		echo $"E: rpm build target ${TARGET} is NOT supported"
+		return 1
 	    fi
 	fi
 
@@ -740,7 +602,8 @@ RPM_Remove(){
     mount-chroot vfs
     apt-get-update --chroot
 
-    [ -f $RPM_PKG ] && Msg_NotPackageName_$LOCALE $RPM_PKG && return 1
+    [ -f $RPM_PKG ] && \
+	echo $"E: $RPM_PKG is not a package name" && return 1
     $__chroot_sh "apt-get -y remove $BASE_RPM_PKG"
 
     write-vbuilder-log "remove-rpm $RPM_PKG"
@@ -779,7 +642,8 @@ RPM_Build(){
     mount-chroot vfs
     apt-get-update --chroot
 
-    [ ! -f $RPM_PKG ] && Msg_NotSourceRPM_$LOCALE $RPM_PKG && return 1
+    [ ! -f $RPM_PKG ] && \
+	echo $"E: $RPM_PKG is not a source RPM package" && return 1
     
     RPM_PKG_USER=$(stat -c %U $RPM_PKG)
     RPM_PKG_GROUP=$(stat -c %G $RPM_PKG)
@@ -828,7 +692,8 @@ RPM_Build(){
 RPM_Sign(){
     [ $with_sign -eq 1 ] || return 1
 
-    [ -z "${SUDO_USER}" ] && Msg_SUDO_USERisEmpty_$LOCALE && return 1
+    [ -z "${SUDO_USER}" ] && \
+	echo $"W: \$SUDO_USER is empty" && return 1
 
     su ${SUDO_USER} -c "rpm --addsign $(for i in $RPM_PKG_ARCH_LIST; do find $BUILD_ROOT${BUILD_DIR}/${i} -type f -regex '.*\.rpm' 2>/dev/null; done | sed -e s,$BUILD_ROOT${BUILD_DIR},${BUILT_RPMS_DIR}/${MAJOR_VERSION},g -e 's/$/ \\/g')"
 
@@ -838,12 +703,12 @@ RPM_Sign(){
 
 ##############################################################################
 
-require-root $* || exit 1
-
 setup-vbuilder || exit 1
 
 check-parameter $* || exit 1
 
+require-root $* || exit 1
+
 while [ $# -gt 0 ]; do
     tmpARG=$1
     case $tmpARG in