Browse Source

Fix some typos, add more error checking.

master
Peter J. Jones 11 years ago
parent
commit
3f9ab6acae

+ 49
- 40
lib/admintools/cvsup.sh View File

@@ -24,61 +24,70 @@
################################################################################
atools_srcsup_check ()
{
# $1 set to YES to die when SUP_UPDATE is not set
# $2 set to YES to skip the sup tag check
# $1 set to YES to die when SUP_UPDATE is not set
# $2 set to YES to skip the sup tag check

supupdate=`atools_make_var SUP_UPDATE`
if [ "x$supupdate" = "x" ]; then
echo "You don't have SUP_UPDATE set in /etc/make.conf"
echo "Use atools_use_src_sup in your sysupdate.conf and run sysupdate"
[ "x$1" = "xYES" ] && exit 1
fi
supupdate=`atools_make_var SUP_UPDATE`
if [ "x$supupdate" = "x" ]; then
echo "You don't have SUP_UPDATE set in /etc/make.conf"
echo "Use atools_use_src_sup in your sysupdate.conf and run sysupdate"
[ "x$1" = "xYES" ] && exit 1
fi

supfile=`atools_make_var SUPFILE`
if [ "x$supfile" = "x" ]; then
echo "You don't have SUPFILE set in /etc/make.conf"
echo "Use atools_use_src_sup in your sysupdate.conf and run sysupdate"
[ "x$1" = "xYES" ] && exit 1
fi
supfile=`atools_make_var SUPFILE`
if [ "x$supfile" = "x" ]; then
echo "You don't have SUPFILE set in /etc/make.conf"
echo "Use atools_use_src_sup in your sysupdate.conf and run sysupdate"
[ "x$1" = "xYES" ] && exit 1
fi

if [ "x$2" != "xYES" ]; then
suptag=`egrep '^\*default.*tag=' $supfile | sed 's/^.*tag=//'`
correct_tag=`atools_mk_sup_tag`
if [ "x$2" != "xYES" ]; then
suptag=`egrep '^\*default.*tag=' $supfile | sed 's/^.*tag=//'`
correct_tag=`atools_mk_sup_tag`

if ! echo $suptag | egrep -q "^$correct_tag\$"; then
echo "Your cvsup tag is set to $suptag, you should only use $0 with"
echo "the release engineering tag for security updates, please correct"
echo "your $supfile file to include the correct cvsup tag ($correct_tag)"
[ "x$1" = "xYES" ] && exit 1
fi
if ! echo $suptag | egrep -q "^$correct_tag\$"; then
echo "Your cvsup tag is set to $suptag, you should only use $0 with"
echo "the release engineering tag for security updates, please correct"
echo "your $supfile file to include the correct cvsup tag ($correct_tag)"
[ "x$1" = "xYES" ] && exit 1
fi
fi
atools_mk_sup_file
}
################################################################################
atools_mk_sup_tag ()
{
echo "RELENG_"`uname -r | sed 's/-.*$//' | tr . _`
echo "RELENG_"`uname -r | sed 's/-.*$//' | tr . _`
}
################################################################################
atools_use_src_sup ()
atools_mk_sup_file ()
{
# we need cvsup installed
atools_pkg cvsup
src_supfile="/usr/src/share/examples/cvsup/standard-supfile"
dst_supfile="${PREFIX:-/usr/local}/etc/atools-srcsup"

# setup /etc/make.conf for using cvsup
errors=`atools_srcsup_check NO YES`
[ "x$errors" = "x" ] && return

src_supfile="/usr/src/share/examples/cvsup/standard-supfile"
dst_supfile="${PREFIX:-/usr/local}/etc/atools-srcsup"

if [ ! -r $src_supfile ]; then
echo "$0: I can't find $src_supfile, please check your system"
exit 1
fi
if [ ! -r $src_supfile ]; then
echo "$0: I can't find $src_supfile, please check your system"
exit 1
fi

atools_sub_status "Configuring make.conf for cvsup" YES
atools_install_snippet etc make.conf srcsup
if [ ! -r $dst_supfile ]; then
correct_tag=`atools_mk_sup_tag`
mkdir -p `dirname $dst_supfile`
sed -E -e "s|tag=.*\$|tag=$correct_tag|" < $src_supfile > $dst_supfile
fi
}
################################################################################
atools_use_src_sup ()
{
# we need cvsup installed
atools_pkg cvsup

# setup /etc/make.conf for using cvsup
errors=`atools_srcsup_check NO YES`
[ "x$errors" = "x" ] && return

atools_sub_status "Configuring make.conf for cvsup" YES
atools_install_snippet etc make.conf srcsup
}
################################################################################

+ 13
- 4
lib/admintools/init.sh View File

@@ -32,10 +32,19 @@

# root check
if [ "x$ATOOLS_SKIP_ROOT_CHECK" != "xYES" ]; then
if [ `id -u` -ne 0 ]; then
echo "$0: please become root first"
exit 1
fi
if [ `id -u` -ne 0 ]; then
echo "$0: please become root first"
exit 1
fi
fi

# make sure PATH is correct
PATH=${PREFIX:-/usr/local}/bin:$PATH

# check for nout binary
if ! which nout > /dev/null; then
echo "$0: missing nout tool, did you 'make install'?"
exit 1
fi

# load other libs

+ 13
- 3
lib/admintools/install.sh View File

@@ -28,6 +28,11 @@ atools_install_raw ()
# $2 dest files
# All others are options passed to sed

if [ $# -lt 2 ]; then
echo "BUG: atools_install_raw: not enough args: $*"
exit 1
fi
src_file=$1
shift

@@ -38,8 +43,8 @@ atools_install_raw ()

sed -e "s|@@PREFIX@@|${PREFIX:-/usr/local}|g" \
-e "s|@@DATE@@|$date|g" \
$* \
$src_file >> $dst_file
"$@" \
$src_file >> $dst_file || exit 1
}
################################################################################
atools_install_snippet ()
@@ -49,6 +54,11 @@ atools_install_snippet ()
# $3 snippet
# All others are options passed to sed

if [ $# -lt 3 ]; then
echo "BUG: atools_install_snippet: not enough args: $*"
exit 1
fi
dir=`echo $1 | tr . /`
src_file="${PREFIX:-.}/share/admintools/$1/$2/$3"
dst_file="/$dir/$2"
@@ -59,6 +69,6 @@ atools_install_snippet ()
exit 1
fi

atools_install_raw $src_file $dst_file $*
atools_install_raw $src_file $dst_file "$@"
}
################################################################################

+ 1
- 0
lib/admintools/sendmail.sh View File

@@ -82,6 +82,7 @@ atools_sendmail_with_ssl ()
atools_sub_status "Enabling saslauthd" YES
atools_install_snippet etc rc.conf saslauthd
atools_sub_status "Starting saslauthd"
/usr/local/etc/rc.d/saslauthd stop > /dev/null 2>&1 # just in case
atools_using_nout /usr/local/etc/rc.d/saslauthd start

if ! atools_make_var_has SENDMAIL_CFLAGS 'SASL'; then

+ 3
- 0
script/install.sh View File

@@ -60,3 +60,6 @@ copy_into_place ()
for file in `find -f bin -f etc -f lib -f libexec -f share -type f`; do
copy_into_place $file
done

# TODO: create dest directories
# TODO: set prefix in init.sh

+ 2
- 2
share/admintools/etc/make.conf/srcsup View File

@@ -1,6 +1,6 @@
# added by admintools on @@DATE@@
SUP_UPDATE= YES
SUP= @@PREFIX@@/bin/cvsup
SUPFLAGS= -g -L 2
SUPHOST= cvsup12.FreeBSD.org
SUPFLAGS= -g -L 2 -r 1 -z
SUPHOST= cvsup4.FreeBSD.org
SUPFILE= @@PREFIX@@/etc/atools-srcsup

+ 4
- 0
src/nout/nout.c View File

@@ -21,6 +21,10 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Run a command, and display a spinner instead of its output.
*
* TODO: Catch ^C and terminate the child process.
*
**************************************************************************/
#include <stdio.h>
#include <stdlib.h>

Loading…
Cancel
Save