refactored user interaction
parent
3d6030b43b
commit
1dfb44feed
106
build.sh
106
build.sh
|
@ -158,6 +158,23 @@ log_info() { log 2 $@; } # print message in GREEN ; but not when --silent
|
||||||
log_note() { log 3 $@; } # print message ; with --verbose and --debug
|
log_note() { log 3 $@; } # print message ; with --verbose and --debug
|
||||||
log_debug() { log 4 $@; } # print message in YELLOW; only with --debug
|
log_debug() { log 4 $@; } # print message in YELLOW; only with --debug
|
||||||
|
|
||||||
|
## -- user interaction
|
||||||
|
|
||||||
|
user_confirmation () {
|
||||||
|
if [ ! $NOINTERACT = 1 ]; then
|
||||||
|
log_show $@
|
||||||
|
log_show -n "(y/n)"
|
||||||
|
while true; do
|
||||||
|
read -p "" answer
|
||||||
|
case $answer in
|
||||||
|
[Yy]* ) break;;
|
||||||
|
[Nn]* ) exit 1;;
|
||||||
|
* ) log_show "Please answer yes or no.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
## -- commands
|
## -- commands
|
||||||
|
|
||||||
check_path() {
|
check_path() {
|
||||||
|
@ -274,7 +291,7 @@ check_pdftoppm() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_error "Program 'pdftoppm' not found."
|
log_note "Program 'pdftoppm' not found."
|
||||||
# no # exit 1 ## can still modify ImageMagick policy!
|
# no # exit 1 ## can still modify ImageMagick policy!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,20 +309,9 @@ check_imagemagick_policy() {
|
||||||
|
|
||||||
if [ $PDFTOPPM_CONVERT = 0 ]; then
|
if [ $PDFTOPPM_CONVERT = 0 ]; then
|
||||||
## modify ImageMagick-6/policy.xml
|
## modify ImageMagick-6/policy.xml
|
||||||
if [ $NOINTERACT = 0 ]; then
|
user_confirmation "Be sure to have either poppler(-utils) installed or an ImageMagick \
|
||||||
log_show "Be sure to have either poppler(-utils) installed or an ImageMagick \
|
policy which allows for PDF conversion! Do you wish to temporaly remove \
|
||||||
policy which allows for PDF conversion! Do you wish to temporaly remove \
|
the policy preventing ImageMagick from converting PDFs?"
|
||||||
the policy preventing ImageMagick from converting PDFs?"
|
|
||||||
log_show -n "(y/n)"
|
|
||||||
while true; do
|
|
||||||
read -p "" answer
|
|
||||||
case $answer in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit 1;;
|
|
||||||
* ) log_show "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_sudo
|
check_sudo
|
||||||
|
|
||||||
|
@ -440,19 +446,10 @@ check_url2() {
|
||||||
|
|
||||||
log_show "WARNING: URL for [Unreleased] in CHANGELOG.md does not reflect the current version $VERSION_NUM."
|
log_show "WARNING: URL for [Unreleased] in CHANGELOG.md does not reflect the current version $VERSION_NUM."
|
||||||
log_show "WARNING: Be sure to edit CHANGELOG.md and specify current version!"
|
log_show "WARNING: Be sure to edit CHANGELOG.md and specify current version!"
|
||||||
|
|
||||||
|
user_confirmation "Do you wish to continue without updated URL for [Unreleased]?"
|
||||||
|
|
||||||
if [ $NOINTERACT = 0 ]; then
|
if [ $NOINTERACT = 1 ]; then
|
||||||
log_show "Do you wish to continue without updated URL for [Unreleased]?"
|
|
||||||
log_show -n "(y/n)"
|
|
||||||
while true; do
|
|
||||||
read -p "" answer
|
|
||||||
case $answer in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit 1;;
|
|
||||||
* ) log_show "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
|
||||||
log_error "Aborting in batch mode!"
|
log_error "Aborting in batch mode!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -465,18 +462,7 @@ create_release() {
|
||||||
# This function produces a .zip-file in accordance to the requirements for CTAN.
|
# This function produces a .zip-file in accordance to the requirements for CTAN.
|
||||||
# For more information see https://ctan.org/help/upload-pkg.
|
# For more information see https://ctan.org/help/upload-pkg.
|
||||||
####
|
####
|
||||||
if [ $NOINTERACT = 0 ]; then
|
user_confirmation "Do you wish to create a release for the version $VERSION_NUM?"
|
||||||
log_show "Do you wish to create a release for the version $VERSION_NUM?"
|
|
||||||
log_show -n "(y/n)"
|
|
||||||
while true; do
|
|
||||||
read -p "" answer
|
|
||||||
case $answer in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit 1;;
|
|
||||||
* ) log_show "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
## create backup-file und update VERSIONDATE in tikz-trackschematic.sty
|
## create backup-file und update VERSIONDATE in tikz-trackschematic.sty
|
||||||
sed -i".backup" -e"s/%\[VERSIONDATE/\[$DATE $VERSION_STR/g" src/tikz-trackschematic.sty
|
sed -i".backup" -e"s/%\[VERSIONDATE/\[$DATE $VERSION_STR/g" src/tikz-trackschematic.sty
|
||||||
|
@ -524,18 +510,8 @@ create_release() {
|
||||||
}
|
}
|
||||||
|
|
||||||
create_release_notes() {
|
create_release_notes() {
|
||||||
if [ $NOINTERACT = 0 ]; then
|
user_confirmation "Do you wish to create a release notes for the version $VERSION_NUM?"
|
||||||
log_show "Do you wish to create a release notes for the version $VERSION_NUM?"
|
|
||||||
log_show -n "(y/n)"
|
|
||||||
while true; do
|
|
||||||
read -p "" answer
|
|
||||||
case $answer in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit 1;;
|
|
||||||
* ) log_show "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
## -- create release note as excerpt from CHANGELOG.md
|
## -- create release note as excerpt from CHANGELOG.md
|
||||||
# determine beginning and end in CHANGELOG.md
|
# determine beginning and end in CHANGELOG.md
|
||||||
TOP=$(grep -n "Version \[$VERSION_NUM\]" CHANGELOG.md | cut -d: -f1)
|
TOP=$(grep -n "Version \[$VERSION_NUM\]" CHANGELOG.md | cut -d: -f1)
|
||||||
|
@ -653,18 +629,8 @@ link_dev_files() {
|
||||||
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
TEXMFLOCAL=$(kpsewhich --var-value TEXMFLOCAL)
|
||||||
DEVDIR="$TEXMFLOCAL/tex/latex/tikz-trackschematic-dev"
|
DEVDIR="$TEXMFLOCAL/tex/latex/tikz-trackschematic-dev"
|
||||||
PROJECTDIR=$(pwd -P)
|
PROJECTDIR=$(pwd -P)
|
||||||
if [ $NOINTERACT = 0 ]; then
|
|
||||||
log_show "Do you wish to install this package for development to $DEVDIR?"
|
user_confirmation "Do you wish to install this package for development to $DEVDIR?"
|
||||||
log_show -n "(y/n)"
|
|
||||||
while true; do
|
|
||||||
read -p "" answer
|
|
||||||
case $answer in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit 1;;
|
|
||||||
* ) log_show "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure that destination folder exists
|
# make sure that destination folder exists
|
||||||
if [ ! -d "$DEVDIR" ]; then
|
if [ ! -d "$DEVDIR" ]; then
|
||||||
|
@ -704,18 +670,8 @@ link_dev_files() {
|
||||||
remove_dev_files() {
|
remove_dev_files() {
|
||||||
# destination folder inside the TeX Live installation
|
# destination folder inside the TeX Live installation
|
||||||
cd $DEVDIR # from check_trackschematic
|
cd $DEVDIR # from check_trackschematic
|
||||||
if [ $NOINTERACT = 0 ]; then
|
user_confirmation "Do you wish to remove the package '$DEVDIR'?"
|
||||||
log_show "Do you wish to remove the package '$DEVDIR'?"
|
|
||||||
log_show -n "(y/n)"
|
|
||||||
while true; do
|
|
||||||
read -p "" answer
|
|
||||||
case $answer in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit 1;;
|
|
||||||
* ) log_show "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
log_note "removing $DEVDIR!"
|
log_note "removing $DEVDIR!"
|
||||||
$rootrun rm -f *
|
$rootrun rm -f *
|
||||||
cd ..
|
cd ..
|
||||||
|
|
Loading…
Reference in New Issue