forked from heroku/heroku-buildpack-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,446 changed files
with
865 additions
and
158,452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/bin/bash | ||
# Implement HMAC functionality on top of the OpenSSL digest functions. | ||
# licensed under the terms of the GNU GPL v2 | ||
# Copyright 2007 Victor Lowther <[email protected]> | ||
|
||
die() { | ||
echo $* | ||
exit 1 | ||
} | ||
|
||
check_deps() { | ||
local res=0 | ||
while [ $# -ne 0 ]; do | ||
which "${1}" >& /dev/null || { res=1; echo "${1} not found."; } | ||
shift | ||
done | ||
(( res == 0 )) || die "aborting." | ||
} | ||
|
||
# write a byte (passed as hex) to stdout | ||
write_byte() { | ||
# $1 = byte to write | ||
printf "\\x$(printf "%x" ${1})" | ||
} | ||
|
||
# make an hmac pad out of a key. | ||
# this is not the most secure way of doing it, but it is | ||
# the most expedient. | ||
make_hmac_pad() { | ||
# using key in file $1 and byte in $2, create the appropriate hmac pad | ||
# Pad keys out to $3 bytes | ||
# if key is longer than $3, use hash $4 to hash the key first. | ||
local x y a size remainder oifs | ||
(( remainder = ${3} )) | ||
# in case someone else was messing with IFS. | ||
for x in $(echo -n "${1}" | od -v -t u1 | cut -b 9-); | ||
do | ||
write_byte $((${x} ^ ${2})) | ||
(( remainder -= 1 )) | ||
done | ||
for ((y=0; remainder - y ;y++)); do | ||
write_byte $((0 ^ ${2})) | ||
done | ||
} | ||
|
||
# utility functions for making hmac pads | ||
hmac_ipad() { | ||
make_hmac_pad "${1}" 0x36 ${2} "${3}" | ||
} | ||
|
||
hmac_opad() { | ||
make_hmac_pad "${1}" 0x5c ${2} "${3}" | ||
} | ||
|
||
# hmac something | ||
do_hmac() { | ||
# $1 = algo to use. Must be one that openssl knows about | ||
# $2 = keyfile to use | ||
# $3 = file to hash. uses stdin if none is given. | ||
# accepts input on stdin, leaves it on stdout. | ||
# Output is binary, if you want something else pipe it accordingly. | ||
local blocklen keysize x | ||
case "${1}" in | ||
sha) blocklen=64 ;; | ||
sha1) blocklen=64 ;; | ||
md5) blocklen=64 ;; | ||
md4) blocklen=64 ;; | ||
sha256) blocklen=64 ;; | ||
sha512) blocklen=128 ;; | ||
*) die "Unknown hash ${1} passed to hmac!" ;; | ||
esac | ||
cat <(hmac_ipad ${2} ${blocklen} "${1}") "${3:--}" | openssl dgst "-${1}" -binary | \ | ||
cat <(hmac_opad ${2} ${blocklen} "${1}") - | openssl dgst "-${1}" -binary | ||
} | ||
|
||
[[ ${1} ]] || die "Must pass the name of the hash function to use to ${0}". | ||
|
||
check_deps od openssl | ||
do_hmac "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
node_version="$1" | ||
|
||
if [ "$node_version" == "" ]; then | ||
echo "usage: $0 VERSION" | ||
exit 1 | ||
fi | ||
|
||
if [ "$S3_ACCESS_KEY_ID" == "" ]; then | ||
echo "must set S3_ACCESS_KEY_ID" | ||
exit 1 | ||
fi | ||
|
||
if [ "$S3_SECRET_ACCESS_KEY" == "" ]; then | ||
echo "must set S3_SECRET_ACCESS_KEY" | ||
exit 1 | ||
fi | ||
|
||
basedir="$( cd -P "$( dirname "$0" )" && pwd )" | ||
|
||
# make a temp directory | ||
tempdir="$( mktemp -t node_XXXX )" | ||
rm -rf $tempdir | ||
mkdir -p $tempdir | ||
|
||
cd $tempdir && | ||
|
||
# download and extract node | ||
curl http://nodejs.org/dist/node-v${node_version}.tar.gz -o node.tgz && | ||
tar xzvf node.tgz && | ||
|
||
cd node-v${node_version} && | ||
|
||
# build and package nodejs for heroku | ||
heroku make -v -o $tempdir/node-${node_version}.tgz && | ||
|
||
# upload nodejs to s3 | ||
$basedir/s3 put language-pack-nodejs \ | ||
nodejs-${node_version}.tgz $tempdir/node-${node_version}.tgz && | ||
|
||
# package scons | ||
scons_version=$(ls tools/scons | grep "scons-local" | cut -d- -f3) && | ||
cd tools/scons && | ||
tar czvf $tempdir/scons-${scons_version}.tgz * && | ||
|
||
# upload scons to s3 | ||
$basedir/s3 put language-pack-nodejs \ | ||
scons-${scons_version}.tgz $tempdir/scons-${scons_version}.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
npm_version="$1" | ||
|
||
if [ "$npm_version" == "" ]; then | ||
echo "usage: $0 VERSION" | ||
exit 1 | ||
fi | ||
|
||
basedir="$( cd -P "$( dirname "$0" )" && pwd )" | ||
|
||
# make a temp directory | ||
tempdir="$( mktemp -t node_XXXX )" | ||
rm -rf $tempdir | ||
mkdir -p $tempdir | ||
|
||
cd $tempdir && | ||
|
||
# download npm | ||
git clone https://github.com/isaacs/npm.git && | ||
|
||
cd npm && | ||
|
||
# grab the right version | ||
git checkout v${node_version} && | ||
git submodule update --init --recursive && | ||
find . -name ".git" -exec rm -rf {} \; | ||
|
||
# package it up | ||
tar czvf $tempdir/npm-${npm_version}.tgz * | ||
|
||
# upload npm to s3 | ||
$basedir/s3 put language-pack-nodejs \ | ||
npm-${npm_version}.tgz $tempdir/npm-${npm_version}.tgz |
Oops, something went wrong.