Skip to content

Instantly share code, notes, and snippets.

@jasonwmiller
Forked from hajdbo/nginx_release.sh
Last active September 5, 2015 03:45
Show Gist options
  • Select an option

  • Save jasonwmiller/b4637db51917b058a6b7 to your computer and use it in GitHub Desktop.

Select an option

Save jasonwmiller/b4637db51917b058a6b7 to your computer and use it in GitHub Desktop.

Revisions

  1. @hajdbo hajdbo revised this gist May 6, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx_release.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    #####

    echo "[CMD] verifying dependencies"
    DEPS="debhelper libgd2-xpm-dev libgeoip-dev liblua5.1-dev libmhash-dev libpam0g-dev libperl-dev libxslt1-dev po-debconf"
    DEPS="debhelper libgd2-xpm-dev libgeoip-dev liblua5.1-0-dev libmhash-dev libpam0g-dev libperl-dev libxslt1-dev po-debconf"
    for i in $DEPS ; do
    dpkg-query -W -f='${Package}\n' | grep ^$i$ > /dev/null
    if [ $? != 0 ] ; then
  2. @hajdbo hajdbo revised this gist May 6, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion nginx_release.sh
    Original file line number Diff line number Diff line change
    @@ -16,8 +16,12 @@ for i in $DEPS ; do
    dpkg-query -W -f='${Package}\n' | grep ^$i$ > /dev/null
    if [ $? != 0 ] ; then
    echo "You need to install $i"
    missing_package=1
    fi
    done
    done
    if [ $missing_package == 1 ] ; then
    exit
    fi

    echo "[CMD] make a source directory and cd into it"
    mkdir src
  3. @hajdbo hajdbo revised this gist May 6, 2013. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions nginx_release.sh
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,15 @@
    #
    #####

    echo "[CMD] verifying dependencies"
    DEPS="debhelper libgd2-xpm-dev libgeoip-dev liblua5.1-dev libmhash-dev libpam0g-dev libperl-dev libxslt1-dev po-debconf"
    for i in $DEPS ; do
    dpkg-query -W -f='${Package}\n' | grep ^$i$ > /dev/null
    if [ $? != 0 ] ; then
    echo "You need to install $i"
    fi
    done

    echo "[CMD] make a source directory and cd into it"
    mkdir src
    cd src
  4. @hajdbo hajdbo revised this gist May 6, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx_release.sh
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ echo "[CMD] get the current time for this release"
    release_time=$(LC_TIME=en_US.UTF-8 date +"%a, %d %b %Y %I:%M:%S %z")

    echo "[CMD] update the changelog"
    echo -e "nginx (${nginx_version}-${minor_version}${RELEASE_TAGS}) ${ubuntu_release}; urgency=low
    echo "nginx (${nginx_version}-${minor_version}${RELEASE_TAGS}) ${ubuntu_release}; urgency=low
    [ ${RELEASE_MAINTAINER} ]
    * New release: ${RELEASE_MESSAGE}
  5. @hajdbo hajdbo revised this gist May 6, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx_release.sh
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,7 @@ echo "[CMD] get the current ubuntu release"
    ubuntu_release=$(head -n 1 changelog| sed 's/ *\;.*//'|cut -d ' ' -f 3)

    echo "[CMD] get the current time for this release"
    release_time=$(date +"%a, %d %b %Y %I:%M:%S %z")
    release_time=$(LC_TIME=en_US.UTF-8 date +"%a, %d %b %Y %I:%M:%S %z")

    echo "[CMD] update the changelog"
    echo -e "nginx (${nginx_version}-${minor_version}${RELEASE_TAGS}) ${ubuntu_release}; urgency=low
  6. Jose Diaz-Gonzalez created this gist Nov 21, 2012.
    75 changes: 75 additions & 0 deletions nginx_release.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    #!/bin/bash

    #####
    # Builds a custom nginx
    #
    # RELEASE_TAGS="+your+tags+here"
    # RELEASE_MAINTAINER="Your Name Here"
    # RELEASE_MAINTAINER_EMAIL="[email protected]"
    # RELEASE_MESSAGE="Some message"
    #
    #####

    echo "[CMD] make a source directory and cd into it"
    mkdir src
    cd src

    echo "[CMD] get the source from debian/ubuntu"
    apt-get source nginx

    echo "[CMD] get the nginx version"
    nginx_version=`ls -lahF .|grep nginx|grep '^d[rwx-]\{9\} '| grep '\/$'|rev|cut -d' ' -f1 | rev|sed 's/nginx-//'|sed 's/\///'`

    echo "[CMD] retrieve all the nginx modules you want"
    cd "nginx-${nginx_version}/debian/modules"

    echo "[CMD] clone all the nginx modules from github"
    git clone -q git://github.com/zebrafishlabs/nginx-statsd.git
    git clone -q git://github.com/FRiCKLE/ngx_coolkit.git

    cd ..

    echo "[CMD] ensure the proper dependencies are in place"
    cat control | sed 's/libgd2-noxpm-dev/libgd2-xpm-dev/' >> tmp ; rm control ; mv tmp control

    echo "[CMD] remove unneeded and broken modules"
    cat rules |sed '/with-http_image_filter_module/ d' >> tmp ; rm rules ; mv tmp rules

    echo "[CMD] split up the rules file so we can rewrite it"
    awk '/\$\(CONFIGURE_OPTS\)/{n++}{filename = "rule-" n ; print > filename }' rules

    echo "[CMD] adding modules to the nginx-full package"
    echo -e "\t --add-module=\$(MODULESDIR)/headers-more-nginx-module \\" >> rule-
    echo -e "\t --add-module=\$(MODULESDIR)/nginx-development-kit \\" >> rule-
    echo -e "\t --add-module=\$(MODULESDIR)/nginx-lua \\" >> rule-
    echo -e "\t --add-module=\$(MODULESDIR)/nginx-statsd \\" >> rule-
    echo -e "\t --add-module=\$(MODULESDIR)/ngx_coolkit \\" >> rule-

    echo "[CMD] combine all the rule files"
    ls |grep rule-|while read file; do cat $file >> tmp; done; rm rules ; mv tmp rules

    echo "[CMD] get the current nginx minor nginx_version"
    minor_version=$(head -n 1 changelog | sed 's/ *ubuntu.*//' | sed 's/nginx (//'|cut -d '-' -f 2);
    minor_version=$(($minor_version + 1));

    echo "[CMD] get the current ubuntu release"
    ubuntu_release=$(head -n 1 changelog| sed 's/ *\;.*//'|cut -d ' ' -f 3)

    echo "[CMD] get the current time for this release"
    release_time=$(date +"%a, %d %b %Y %I:%M:%S %z")

    echo "[CMD] update the changelog"
    echo -e "nginx (${nginx_version}-${minor_version}${RELEASE_TAGS}) ${ubuntu_release}; urgency=low
    [ ${RELEASE_MAINTAINER} ]
    * New release: ${RELEASE_MESSAGE}
    -- ${RELEASE_MAINTAINER} <${RELEASE_MAINTAINER_EMAIL}> ${release_time}
    "|cat - changelog > tmp && mv tmp changelog

    echo "[CMD] Create a build"
    cd ..
    dpkg-buildpackage

    echo "[CMD] DONE!"