mirror of
https://github.com/sbopkg/sbopkg
synced 2025-02-10 20:47:56 +01:00
multiple changes due to pid file not being correctly removed when using cli; separate out the config file check and the directory (sanity) checks in order to correctly change SLACKVER at the cli
This commit is contained in:
parent
078395474f
commit
1620caf654
1 changed files with 18 additions and 22 deletions
|
@ -41,11 +41,9 @@ CWD="$(pwd)"
|
||||||
SBOVER=SVN
|
SBOVER=SVN
|
||||||
UPDATE_DEBUG="1" # This will be uncommented in SVN and RC releases
|
UPDATE_DEBUG="1" # This will be uncommented in SVN and RC releases
|
||||||
|
|
||||||
sanity_checks () {
|
config_check () {
|
||||||
# Check if config file is there and if so check that it has all
|
# Check if config file is there and if so check that it has all
|
||||||
# needed variables with any value, and set them; also check and
|
# needed variables with any value, and set them.
|
||||||
# see if local repository directory exists; also create $SRCDIR
|
|
||||||
# if it's not there.
|
|
||||||
if [ ! -e $SBOPKG_CONF ]; then
|
if [ ! -e $SBOPKG_CONF ]; then
|
||||||
echo "$SCRIPT: No $SBOPKG_CONF file was found."
|
echo "$SCRIPT: No $SBOPKG_CONF file was found."
|
||||||
echo "Please create it and run $SCRIPT again." 1>&2
|
echo "Please create it and run $SCRIPT again." 1>&2
|
||||||
|
@ -66,6 +64,11 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sanity_checks () {
|
||||||
|
# Set and check for pid file; check and see if local repository,
|
||||||
|
# $SRCDIR, and $TMPDIR exist and if not, offer to create them.
|
||||||
PIDFILE=$TMP/sbopkg.pid
|
PIDFILE=$TMP/sbopkg.pid
|
||||||
trap 'rm -rf $PIDFILE; exit 1' TERM INT
|
trap 'rm -rf $PIDFILE; exit 1' TERM INT
|
||||||
if [ -e $PIDFILE ]; then
|
if [ -e $PIDFILE ]; then
|
||||||
|
@ -149,6 +152,7 @@ have done an rsync first." 12 30
|
||||||
echo "or is empty. Please make sure your respository"
|
echo "or is empty. Please make sure your respository"
|
||||||
echo "directory is set correctly and that you have done"
|
echo "directory is set correctly and that you have done"
|
||||||
echo "an rsync first."
|
echo "an rsync first."
|
||||||
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -170,6 +174,7 @@ correctly and that you have done an rsync first." 10 30
|
||||||
echo "No ChangeLog.txt found. Please make sure your"
|
echo "No ChangeLog.txt found. Please make sure your"
|
||||||
echo "repository directory is set correctly and that"
|
echo "repository directory is set correctly and that"
|
||||||
echo "you have done an rsync first. Exiting."
|
echo "you have done an rsync first. Exiting."
|
||||||
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -658,6 +663,7 @@ permissions on the target directory." 8 30
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
echo "You do not have write permissons on the target directory."
|
echo "You do not have write permissons on the target directory."
|
||||||
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -885,7 +891,7 @@ addition to the original SlackBuild."
|
||||||
;;
|
;;
|
||||||
l* | L* ) SLACKBUILD="local" ; break
|
l* | L* ) SLACKBUILD="local" ; break
|
||||||
;;
|
;;
|
||||||
c* | C* ) SLACKBUILD="cancel" ; exit 0
|
c* | C* ) SLACKBUILD="cancel" ; cleanup; exit 0
|
||||||
;;
|
;;
|
||||||
* ) echo "Unknown response."
|
* ) echo "Unknown response."
|
||||||
;;
|
;;
|
||||||
|
@ -1007,10 +1013,13 @@ done
|
||||||
|
|
||||||
cleanup # Do this first just in case there is cruft left over.
|
cleanup # Do this first just in case there is cruft left over.
|
||||||
|
|
||||||
|
config_check # Next, check to make sure we have a valid config.
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
DIAG=1
|
DIAG=1
|
||||||
sanity_checks
|
sanity_checks
|
||||||
main_menu
|
main_menu
|
||||||
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1073,17 +1082,18 @@ done
|
||||||
# End of option parsing.
|
# End of option parsing.
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
sanity_checks
|
|
||||||
|
|
||||||
if [ -n "$VERSION" ]; then
|
if [ -n "$VERSION" ]; then
|
||||||
SLACKVER=$CUSTOMVER
|
SLACKVER=$CUSTOMVER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sanity_checks
|
||||||
|
|
||||||
if [ -n "$BUILD" ]; then
|
if [ -n "$BUILD" ]; then
|
||||||
check_root
|
check_root
|
||||||
if [ $ROOT = "false" ]; then
|
if [ $ROOT = "false" ]; then
|
||||||
echo "You must run this script as the root user in order \
|
echo "You must run this script as the root user in order \
|
||||||
to build packages."
|
to build packages."
|
||||||
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
SBOPKGOUTPUT=$TMP/sbopkg_output
|
SBOPKGOUTPUT=$TMP/sbopkg_output
|
||||||
|
@ -1102,33 +1112,25 @@ to build packages."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
rm -rf $SBOPKGOUTPUT
|
rm -rf $SBOPKGOUTPUT
|
||||||
cleanup
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CHK_UPDATES" ]; then
|
if [ -n "$CHK_UPDATES" ]; then
|
||||||
check_for_updates
|
check_for_updates
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CHANGELOG" ]; then
|
if [ -n "$CHANGELOG" ]; then
|
||||||
show_changelog
|
show_changelog
|
||||||
cleanup
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$GETPKGS" ]; then
|
if [ -n "$GETPKGS" ]; then
|
||||||
get_sbo_packages
|
get_sbo_packages
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$RSYNC" ]; then
|
if [ -n "$RSYNC" ]; then
|
||||||
echo "Rsyncing with Slackbuilds.org repository into \
|
echo "Rsyncing with Slackbuilds.org repository into \
|
||||||
$LOCALREPO/$SLACKVER."
|
$LOCALREPO/$SLACKVER."
|
||||||
rsync_repo
|
rsync_repo
|
||||||
cleanup
|
|
||||||
echo "Finished rsync."
|
echo "Finished rsync."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$SEARCH" ]; then
|
if [ -n "$SEARCH" ]; then
|
||||||
|
@ -1138,7 +1140,6 @@ if [ -n "$SEARCH" ]; then
|
||||||
search_package $PKGSEARCH
|
search_package $PKGSEARCH
|
||||||
show_readme
|
show_readme
|
||||||
done
|
done
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$GENSEARCH" ]; then
|
if [ -n "$GENSEARCH" ]; then
|
||||||
|
@ -1147,11 +1148,6 @@ if [ -n "$GENSEARCH" ]; then
|
||||||
echo "Searching for $PKGSEARCH"
|
echo "Searching for $PKGSEARCH"
|
||||||
gen_search_package $PKGSEARCH
|
gen_search_package $PKGSEARCH
|
||||||
done
|
done
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$VERSION" ]; then
|
|
||||||
SLACKVER=$NEWVER
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
Loading…
Add table
Reference in a new issue