Skip to content

Commit

Permalink
create all packages on building.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelolmo committed Apr 6, 2017
1 parent c7c9898 commit cf97665
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
4 changes: 2 additions & 2 deletions mail/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Mail struct {

func NewNotification() (*Mail, error) {
keys := []string{
"NOTIFY_MAIL_SENDER",
"NOTIFY_MAIL_ACCOUNT",
"NOTIFY_MAIL_PASSWORD",
}
n := map[string]string{}
Expand All @@ -27,7 +27,7 @@ func NewNotification() (*Mail, error) {
}
auth := smtp.PlainAuth(
"Notification",
n["NOTIFY_MAIL_SENDER"],
n["NOTIFY_MAIL_ACCOUNT"],
n["NOTIFY_MAIL_PASSWORD"],
"smtp.gmail.com",
)
Expand Down
39 changes: 16 additions & 23 deletions package
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,30 @@

set -e

BUILD=$(pwd)/build
BUILD=build
version=$(cat VERSION)
size=$(du -csh deb/ | sed '1!d' | grep -oe "^[0-9]*")
goarch=$1

if [ -z $1 ]; then
echo "Missing architecture param."
echo "Usage: ./package ( amd64 | arm )"
exit 1
fi

architecture=$( echo $goarch | sed 's/arm/armhf/g' )

rm -Rf $BUILD
mkdir -p $BUILD/release $BUILD/tmp

echo "Building version $version..."

# Architectures: i386, amd64, armle
ar="amd64 arm"
for arch in ${ar}; do
echo $arch

cp -R deb/* $BUILD/tmp
sed -i 's/{{version}}/'${version}'/g;s/{{size}}/'${size}'/g;s/{{architecture}}/'${architecture}'/g' $BUILD/tmp/DEBIAN/control
rm -rf $BUILD/tmp/*
cp -R deb/* $BUILD/tmp

if [ "$goarch" = "arm" ]; then
GOOS=linux GOARCH=arm GOARM=7 go build -o $BUILD/tmp/usr/bin/notify-mail main.go
fi
if [ "$goarch" = "amd64" ]; then
GOOS=linux GOARCH=amd64 go build -o $BUILD/tmp/usr/bin/notify-mail main.go
fi
GOOS=linux GOARCH=$arch GOARM=7 go build -o $BUILD/tmp/usr/bin/notify-mail main.go
if [ "$arch" = "amd64" ]; then
cp $BUILD/tmp/usr/bin/notify-mail $BUILD/release/notify-mail-x86_64.AppImage
fi

fakeroot dpkg-deb -b -z9 $BUILD/tmp $BUILD/release
architecture=$( echo $arch | sed 's/arm/armhf/g' )
size=$(du -csh $BUILD/tmp | sed '1!d' | grep -oe "^[0-9]*")
sed -i 's/{{version}}/'${version}'/g;s/{{size}}/'${size}'/g;s/{{architecture}}/'${architecture}'/g' $BUILD/tmp/DEBIAN/control

echo done
fakeroot dpkg-deb -b -z9 $BUILD/tmp $BUILD/release
done

echo done

0 comments on commit cf97665

Please sign in to comment.