From 56b67f5a1a9812c0a0007f9eb5acd692ac3c1a40 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 30 Aug 2011 11:38:34 +0200 Subject: Add automatic manpages installation --- README.md | 5 +++++ kerl | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index eb69397..d8688f5 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,7 @@ You can set the following variables: - KERL_AGNER_AUTOINSTALL a list of packages to pre-install - KERL_SASL_STARTUP use SASL system startup instead of minimal - KERL_USE_AUTOCONF use autoconf in the builds process +- KERL_INSTALL_MANPAGES if non-empty will install manpages Glossary ======== @@ -256,6 +257,10 @@ You can auto-install agner packages listing them in the KERL_AGNER_AUTOINSTALL v You can have SASL started automatically setting KERL_SASL_STARTUP=yes in your $HOME/.kerlrc file or prepending it to the command line +#### Manpages installation + +You can have manpages installed automatically setting KERL_INSTALL_MANPAGES=yes in your $HOME/.kerlrc file or prepending it to the command line + update ------ diff --git a/kerl b/kerl index fbc19db..56138da 100755 --- a/kerl +++ b/kerl @@ -39,6 +39,7 @@ fi KERL_CONFIGURE_OPTIONS= KERL_DISABLE_AGNER= KERL_SASL_STARTUP= +KERL_INSTALL_MANPAGES= # ensure the base dir exsists mkdir -p "$KERL_BASE_DIR" @@ -285,21 +286,7 @@ do_build() assert_build_name_unused $2 FILENAME=otp_src_$1.tar.gz - if [ ! -f "$KERL_DOWNLOAD_DIR/$FILENAME" ]; then - echo "Downloading $FILENAME to $KERL_DOWNLOAD_DIR" - mkdir -p "$KERL_DOWNLOAD_DIR" - curl $ERLANG_DOWNLOAD_URL/$FILENAME > "$KERL_DOWNLOAD_DIR/$FILENAME" - update_checksum_file - fi - ensure_checksum_file - echo "Verifying archive checksum..." - SUM=`$MD5SUM "$KERL_DOWNLOAD_DIR/$FILENAME" | cut -d " " -f $MD5SUM_FIELD` - ORIG_SUM=`grep $FILENAME "$KERL_DOWNLOAD_DIR/MD5" | cut -d " " -f 2` - if [ "$SUM" != "$ORIG_SUM" ]; then - echo "Checksum error, check the files in $KERL_DOWNLOAD_DIR" - exit 1 - fi - echo "Checksum verified ($SUM)" + download "$FILENAME" mkdir -p "$KERL_BUILD_DIR/$2" if [ ! -d "$KERL_BUILD_DIR/$2/otp_src_$1" ]; then echo "Extracting source code" @@ -428,6 +415,13 @@ ACTIVATE done fi fi + if [ "$rel" != "git" -a -n "$KERL_INSTALL_MANPAGES" ]; then + echo "Fetching and installing manpages..." + FILENAME=otp_doc_man_$rel.tar.gz + download "$FILENAME" + echo "Extracting manpages" + cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" + fi echo "You can activate this installation running the following command:" echo ". $absdir/activate" echo "Later on, you can leave the installation typing:" @@ -505,6 +499,25 @@ do_active() fi } +download() +{ + if [ ! -f "$KERL_DOWNLOAD_DIR/$1" ]; then + echo "Downloading $1 to $KERL_DOWNLOAD_DIR" + mkdir -p "$KERL_DOWNLOAD_DIR" + curl "$ERLANG_DOWNLOAD_URL/$1" > "$KERL_DOWNLOAD_DIR/$1" + update_checksum_file + fi + ensure_checksum_file + echo "Verifying archive checksum..." + SUM=`$MD5SUM "$KERL_DOWNLOAD_DIR/$1" | cut -d " " -f $MD5SUM_FIELD` + ORIG_SUM=`grep -F "$1" "$KERL_DOWNLOAD_DIR/MD5" | cut -d " " -f 2` + if [ "$SUM" != "$ORIG_SUM" ]; then + echo "Checksum error, check the files in $KERL_DOWNLOAD_DIR" + exit 1 + fi + echo "Checksum verified ($SUM)" +} + case "$1" in build) if [ "$2" = "git" ]; then -- cgit v1.2.3