Misc fixes in scripts

This commit is contained in:
Alexandre Aubin 2019-01-30 18:50:30 +00:00
parent 8ddee56c38
commit 6584a2f830
3 changed files with 10 additions and 11 deletions

View file

@ -12,12 +12,12 @@ source /home/vinaigrette/config/config
function main() function main()
{ {
if [[ "$(tty)" == "not a tty" ]] #if [[ "$(tty)" == "not a tty" ]]
then #then
echo "You aint in a tty (are you in a 'lxc exec' ?)" # echo "You aint in a tty (are you in a 'lxc exec' ?)"
echo "The script can't run because pbuilder won't be happy :|" # echo "The script can't run because pbuilder won't be happy :|"
exit # exit
fi #fi
for PACKAGE in $PACKAGES; for PACKAGE in $PACKAGES;
do do

View file

@ -74,7 +74,7 @@ function build_sources()
{ {
boxed "Building source package of ${PACKAGE} ${VERSION} ..." boxed "Building source package of ${PACKAGE} ${VERSION} ..."
sudo pbuilder execute --bindmounts ${ROOT_DIR} --basetgz ${IMG} -- ${BUILD_SOURCES} $PKG_DIR \ pbuilder execute --bindmounts ${ROOT_DIR} --basetgz ${IMG} -- ${BUILD_SOURCES} $PKG_DIR \
|| critical "An error occured while building source package" || critical "An error occured while building source package"
[[ -f ${CHANGES_FILE} ]] || critical "An error occured while building source package (no change file available)" [[ -f ${CHANGES_FILE} ]] || critical "An error occured while building source package (no change file available)"

View file

@ -3,8 +3,8 @@
readonly THISSCRIPT=$0 readonly THISSCRIPT=$0
readonly PROJECT=$1 readonly PROJECT=$1
readonly BRANCH=$2 readonly BRANCH=$2
readonly DISTRIB=$3 readonly DISTRIB="stretch"
readonly VERSION=$4 readonly VERSION=$3
readonly TAG=$(echo "debian/$VERSION" | tr '~' '-') readonly TAG=$(echo "debian/$VERSION" | tr '~' '-')
source /home/vinaigrette/config/config source /home/vinaigrette/config/config
@ -24,7 +24,6 @@ Usage:
Arguments: Arguments:
<project> moulinette, yunohost, yunohost-admin or SSOwat <project> moulinette, yunohost, yunohost-admin or SSOwat
<branch> testing or stable <branch> testing or stable
<distrib> stretch (can only build for stretch, no jessie)
<version> x.y.z (ex: 2.6.1) <version> x.y.z (ex: 2.6.1)
EOF EOF
@ -38,7 +37,7 @@ function validate_arguments()
{ {
[[ $PROJECT =~ ^yunohost|yunohost-admin|moulinette|SSOwat$ ]] || critical "Invalid project $PROJECT" [[ $PROJECT =~ ^yunohost|yunohost-admin|moulinette|SSOwat$ ]] || critical "Invalid project $PROJECT"
[[ $BRANCH =~ ^testing|stable|unstable$ ]] || critical "Invalid branch $BRANCH" [[ $BRANCH =~ ^testing|stable|unstable$ ]] || critical "Invalid branch $BRANCH"
[[ $DISTRIB =~ ^stretch$ ]]; || critical "Invalid distribution $DISTRIB" [[ $DISTRIB =~ ^stretch$ ]] || critical "Invalid distribution $DISTRIB"
[[ ! -z "$VERSION" ]] || critical "Invalid version $VERSION" [[ ! -z "$VERSION" ]] || critical "Invalid version $VERSION"
[[ "$(tty)" != "not a tty" ]] || critical "You aint in a tty (are you in a 'lxc exec' ?) The script can't run because pbuilder won't be happy :|" [[ "$(tty)" != "not a tty" ]] || critical "You aint in a tty (are you in a 'lxc exec' ?) The script can't run because pbuilder won't be happy :|"
} }