Skip to content

Commit

Permalink
autogen.sh: minor script fixup
Browse files Browse the repository at this point in the history
In case any of the perl / python parts fails (for example if
system default is python3, the script will complain about print),
cd ../.. won't be executed.

Furthermore - if any of those scripts fail, there's no point in
continuing as both files are mandatory.
  • Loading branch information
msoltyspl committed Nov 17, 2016
1 parent 7ebd40f commit fc5f808
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ if [ ! -f scripts/augeas/nutupsconf.aug.in ]
then
if python -c "import re,glob,codecs"; then
echo "Regenerating Augeas ups.conf lens..."
cd scripts/augeas && ./gen-nutupsconf-aug.py && cd ../..
cd scripts/augeas && {
./gen-nutupsconf-aug.py || exit 1
cd ../..
}
else
echo "----------------------------------------------------------------------"
echo "Warning: Python is not available."
echo "Skipping Augeas ups.conf lens regeneration."
echo "Error: Python is not available."
echo "Unable to regenerate Augeas ups.conf lens."
echo "----------------------------------------------------------------------"
exit 1
fi
fi

Expand All @@ -22,12 +26,16 @@ if [ ! -f scripts/udev/nut-usbups.rules.in -o \
then
if perl -e 1; then
echo "Regenerating the USB helper files..."
cd tools && ./nut-usbinfo.pl && cd ..
cd tools && {
./nut-usbinfo.pl || exit 1
cd ..
}
else
echo "----------------------------------------------------------------------"
echo "Error: Perl is not available."
echo "Skipping the USB helper files regeneration."
echo "Unable to regenerate USB helper files."
echo "----------------------------------------------------------------------"
exit 1
fi
fi

Expand Down

0 comments on commit fc5f808

Please sign in to comment.