Squashed commit of the following:

remove two echo in xcat-prepivot.sh;
    the stateltie script is updated,
    two typos in the manpage of litefile table are fixed;

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7935 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mxi1 2010-10-27 03:28:15 +00:00
parent aa6dde8fa5
commit d6a37d7277
4 changed files with 54 additions and 26 deletions

View File

@ -144,7 +144,7 @@ litefile => {
options => "Options for the file:\n\n".
" blank, tempfs or rw - \"mount --bind\" is used to mount the file/directory to the root image, and the permission for the file/directory will be the same as the original.\n\n".
" persistent - the file/directory will be persistent across reboots, and the file/directory will be mounted with \"--bind\" option. If the file/directory doesnot exist at first, it will be created during initialization. If the file/directory exists, it will be left alone. ( Requires the statelite table to be filled out with a spot for persistent storage).\n\n".
" con - the contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy doesn not stop when the first match is found. Con is similiar to bind, but all files found in the hierarchy will be concatenated to the file when found. (which is re-designed to use bind option).\n\n".
" con - the contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. Con is similar to bind, but all files found in the hierarchy will be concatenated to the file when found. (which is re-designed to use bind option).\n\n".
" ro - file will be read only. This file will be located in the directory hierarchy specified in the litetree table. The directory will be mounted on the node while the node is running, and the file will be mounted to this directory with \"--bind -o ro\" opton.\n\n".
" link - the file is readwrite and will be placed in tmpfs on the booted node. When searching for the file, the first one to be found in the litetree hierarchy will be used. When the node is rebooted, this file will be reinitialized.\n\n".
" link, con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. Con is similar to tmpfs, but all files found in the hierarchy will be concatenated to the file when found.\n\n".

View File

@ -319,18 +319,17 @@ ProcessType () {
;;
link,con)
echo "cat ${1} >>${TMPFS}${2}" >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} 2>&1
;;
con)
# cons go in bind # TODO ???
# there's one more option to indicate the con is at the end
if [ "${5}" -eq "1" ]; then
if [ "${5}" = "1" ]; then
# mount the file with "--bind" option
echo "mount --bind ${TMPFS}${2} /sysroot${2}" >>$LOG
mount --bind ${TMPFS}${2} /sysroot${2} >> $LOG 2>&1
else
echo "cat ${1} >>${TMPFS}${2}" >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} 2>&1
fi
;;
tempfs) # the default option, same as "tempfs" and "NULL"
@ -385,19 +384,31 @@ ProcessType () {
echo "mount --bind ${TARGET} /sysroot/${ORIG}" >>$LOG
mount --bind ${TARGET} /sysroot/${ORIG}>>$LOG 2>&1
;;
ro) # TODO: change to bind style
ro)
# need to make sure directory exists:
if [ ! -d ${TMPFS}${PPATH} ]; then
mkdir -p ${TMPFS}${PPATH} >>$LOG 2>&1
fi
TARGET=`echo ${TMPFS}${2} | sed -e 's/\/$//'`
#LINK=`echo ${1} | sed -e "s/^${MNTDIR}//"`
DEST=`echo ${1} | sed -e "s/^\/sysroot//"`
#echo "ln -sf ${LINK} ${TARGET}" >>$LOG 2>&1
#ln -sf ${LINK} ${TARGET} >>$LOG 2>&1
echo "mout --bind -o ro ${TARGET} ${DEST}" >>$LOG 2>&1
mount --bind -o ro ${TARGET} ${DEST} >>$LOG 2>&1
# before mount, need to check whether it exists or not
STRPATH="${TMPFS}${2}"
STRLEN=${#STRPATH}
CHAREND=`echo ${STRPATH} | cut -c${STRLEN}`
if [ "${CHAREND}" = "/" ]; then # it is one directory
if [ ! -d ${STRPATH} ]; then
rm -rf ${STRPATH}
mkdir ${STRPATH}
fi
else
if [ ! -f ${STRPATH} ]; then
rm -rf ${STRPATH}
touch ${STRPATH}
fi
fi
echo "mout --bind -o ro ${1} ${MNTDIR}${2}" >>$LOG 2>&1
mount --bind -o ro ${1} ${MNTDIR}${2} >>$LOG 2>&1
;;
*)
;;
@ -421,7 +432,7 @@ FindFile () {
FOUND=0
else
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
if [[ "${2}" -eq "link,con" ]]; then
if [[ "${2}" -eq "link,con" ]] || [[ "${2}" -eq "con" ]]; then
continue
else
break
@ -431,7 +442,7 @@ FindFile () {
done
## for "con" option
if [[ "$FOUND" -eq "1" ]] && [[ "${type}" -eq "con" ]]; then
if [ "$FOUND" = "1" ] && [ "$type" = "con" ]; then
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild} 1
fi

View File

@ -319,18 +319,17 @@ ProcessType () {
;;
link,con)
echo "cat ${1} >>${TMPFS}${2}" >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} 2>&1
;;
con)
# cons go in bind # TODO ???
# there's one more option to indicate the con is at the end
if [ "${5}" -eq "1" ]; then
if [ "${5}" = "1" ]; then
# mount the file with "--bind" option
echo "mount --bind ${TMPFS}${2} /sysroot${2}" >>$LOG
mount --bind ${TMPFS}${2} /sysroot${2} >> $LOG 2>&1
else
echo "cat ${1} >>${TMPFS}${2}" >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} >>$LOG 2>&1
cat ${1} >>${TMPFS}${2} 2>&1
fi
;;
tempfs) # the default option, same as "tempfs" and "NULL"
@ -385,19 +384,37 @@ ProcessType () {
echo "mount --bind ${TARGET} /sysroot/${ORIG}" >>$LOG
mount --bind ${TARGET} /sysroot/${ORIG}>>$LOG 2>&1
;;
ro) # TODO: change to bind style
ro)
# need to make sure directory exists:
if [ ! -d ${TMPFS}${PPATH} ]; then
mkdir -p ${TMPFS}${PPATH} >>$LOG 2>&1
fi
# before mount, need to check whether it exists or not
STRPATH="${TMPFS}${2}"
STRLEN=${#STRPATH}
CHAREND=`echo ${STRPATH} | cut -c${STRLEN}`
if [ "${CHAREND}" = "/" ]; then # it is one directory
if [ ! -d ${STRPATH} ]; then
rm -rf ${STRPATH}
mkdir ${STRPATH}
fi
else
if [ ! -f ${STRPATH} ]; then
rm -rf ${STRPATH}
touch ${STRPATH}
fi
fi
TARGET=`echo ${TMPFS}${2} | sed -e 's/\/$//'`
#LINK=`echo ${1} | sed -e "s/^${MNTDIR}//"`
DEST=`echo ${1} | sed -e "s/^\/sysroot//"`
#echo "ln -sf ${LINK} ${TARGET}" >>$LOG 2>&1
#ln -sf ${LINK} ${TARGET} >>$LOG 2>&1
echo "mout --bind -o ro ${TARGET} ${DEST}" >>$LOG 2>&1
mount --bind -o ro ${TARGET} ${DEST} >>$LOG 2>&1
echo "mout --bind -o ro ${DEST} ${TARGET} " >>$LOG 2>&1
mount --bind -o ro ${DEST} ${TARGET} >>$LOG 2>&1
;;
*)
;;
@ -422,7 +439,7 @@ FindFile () {
FOUND=0
else
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
if [[ "${2}" -eq "link,con" ]]; then
if [[ "${2}" -eq "link,con" ]] || [[ "${2}" -eq "con" ]]; then
continue
else
break

View File

@ -6,8 +6,8 @@ RWDIR=.statelite
if [ ! -z $STATEMNT ]; then #btw, uri style might have left future options other than nfs open, will u se // to detect uri in the future I guess
SNAPSHOTSERVER=${STATEMNT%:*}
SNAPSHOTROOT=${STATEMNT#*/}
echo $SNAPSHOTROOT
echo $SNAPSHOTSERVER
#echo $SNAPSHOTROOT
#echo $SNAPSHOTSERVER
# may be that there is not server and just a directory.
if [ -z $SNAPSHOTROOT ]; then
SNAPSHOTROOT=$SNAPSHOTSERVER