scriptx 0.4.7

ScriptX is a command line tool to extract scriptures out of the American Sign Language version of the New World Translation.
#!/bin/bash
version=`head Cargo.toml | grep "version =" | awk '{print $3}' | sed 's/"//g'`
arch="amd64"
date=`date +"%Y"-"%m"-"%d"`
root_dir=/tmp/scriptx_$version\_$arch/
debian_dir=$root_dir/DEBIAN/
bin_dir=$root_dir/usr/bin
man_dir=$root_dir/usr/share/man/man1/

# Create dir in the temp
mkdir -p $bin_dir
mkdir -p $debian_dir
mkdir -p $man_dir

# Build binary and copy to bin_dir if pass
cargo build --release && cp target/release/scriptx $bin_dir/scriptx

# Generate and compress the man page, help2man has to be installed
help2man -N -S Linux target/release/scriptx | gzip > $man_dir/scriptx.1.gz

# copy and edit control file
cp deb/control $debian_dir/control
sed -i "s/Date: <date>/Date: $date/" $debian_dir/control
sed -i "s/Version: <version>/Version: $version/" $debian_dir/control

# Build deb
dpkg --build $root_dir