mirror of
https://github.com/sbopkg/sbopkg
synced 2025-01-13 20:01:13 +01:00
change version numbers to SVN; from now on, SVN code will remain at version SVN and I will change the version numbers at each release; import initial code to allow the user to change the Slackware version for the matching SBo mirror. In other words, a user can have a local mirror for the Slackware 11.0 SlackBuilds from SBo and also a mirror for the 12.0 SlackBuilds. These would default to /home/sbo/11.0 and /home/sbo/12.0 initially. The user can override the default SLACKVER set in the config file either with the new -v switch for cli users, or from within the dialog interface; also update man pages to reflect this new feature.
This commit is contained in:
parent
704a8e07ce
commit
590667bb8c
3 changed files with 110 additions and 13 deletions
|
@ -32,7 +32,7 @@ SCRIPT=${0##*/}
|
||||||
DIAG=""
|
DIAG=""
|
||||||
SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}"
|
SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}"
|
||||||
CWD="$(pwd)"
|
CWD="$(pwd)"
|
||||||
VER=0.0.6
|
VER=SVN
|
||||||
|
|
||||||
sanity_checks () {
|
sanity_checks () {
|
||||||
# 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
|
||||||
|
@ -57,12 +57,13 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$LOCALREPO/$SLACKVER" ]; then
|
if [ ! -d "$LOCALREPO" ]; then
|
||||||
echo "$SCRIPT: Directory $LOCALREPO/$SLACKVER does not exist."
|
echo "$SCRIPT: Directory $LOCALREPO does not exist."
|
||||||
echo "Please create it and run $SCRIPT again." 1>&2
|
echo "Please create it and run $SCRIPT again." 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
cd $LOCALREPO/$SLACKVER
|
#cd $LOCALREPO/$SLACKVER
|
||||||
|
cd $LOCALREPO
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$SRCDIR" ]; then
|
if [ ! -d "$SRCDIR" ]; then
|
||||||
echo "Creating local cache directory $SRCDIR to keep \
|
echo "Creating local cache directory $SRCDIR to keep \
|
||||||
|
@ -89,8 +90,40 @@ else
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_slack_version () {
|
||||||
|
if [ ! -d "$LOCALREPO/$SLACKVER" ]; then
|
||||||
|
if [ "$DIAG" = 1 ]; then
|
||||||
|
dialog --title "Create directory?" --yesno "The directory \
|
||||||
|
$LOCALREPO/$SLACKVER was not found. Would like to create it? \
|
||||||
|
Select YES to create or NO to return." 10 30
|
||||||
|
if [ $? = 0 ]; then
|
||||||
|
check_root
|
||||||
|
if [ $ROOT = "false" ]; then
|
||||||
|
dialog --title "ERROR" --msgbox "Sorry, only the root \
|
||||||
|
user can create this directory." 8 30
|
||||||
|
break
|
||||||
|
else
|
||||||
|
mkdir -p $LOCALREPO/$SLACKVER
|
||||||
|
dialog --title "Done" --msgbox "The directory has been \
|
||||||
|
created." 8 30
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "$SCRIPT: Directory $LOCALREPO does not exist."
|
||||||
|
echo "Please create it and run $SCRIPT again." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
cd $LOCALREPO/$SLACKVER
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
show_changelog () {
|
show_changelog () {
|
||||||
# Show the changelog
|
# Show the changelog
|
||||||
|
cd $LOCALREPO/$SLACKVER
|
||||||
if [ "$DIAG" = 1 ]; then
|
if [ "$DIAG" = 1 ]; then
|
||||||
if [ ! -e ./ChangeLog.txt ]; then
|
if [ ! -e ./ChangeLog.txt ]; then
|
||||||
dialog --title "ERROR" --msgbox "No ChangeLog.txt \
|
dialog --title "ERROR" --msgbox "No ChangeLog.txt \
|
||||||
|
@ -106,8 +139,24 @@ else
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_version_list () {
|
||||||
|
# This function displays the Slack versions available in the local SBo
|
||||||
|
# repository
|
||||||
|
cd $LOCALREPO
|
||||||
|
rm -f $TMP/sbopkg_version_list 2> /dev/null
|
||||||
|
DIR=( */ )
|
||||||
|
if [ -n "$DIR" ]; then
|
||||||
|
for i in ${DIR[*]%/}; do
|
||||||
|
echo "$i \"SBo repo for Slackware version $i\"" >> \
|
||||||
|
$TMP/sbopkg_version_list
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
get_category_list () {
|
get_category_list () {
|
||||||
# This function displays the list of SBo categories in the dialog
|
# This function displays the list of SBo categories in the dialog
|
||||||
|
cd $LOCALREPO/$SLACKVER
|
||||||
rm -f $TMP/sbopkg_category_list 2> /dev/null
|
rm -f $TMP/sbopkg_category_list 2> /dev/null
|
||||||
DIR=( */ )
|
DIR=( */ )
|
||||||
if [ -n "$DIR" ]; then
|
if [ -n "$DIR" ]; then
|
||||||
|
@ -136,6 +185,26 @@ fi
|
||||||
cd $LOCALREPO/$SLACKVER
|
cd $LOCALREPO/$SLACKVER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select_version () {
|
||||||
|
#get_version_list
|
||||||
|
while [ 0 ]; do
|
||||||
|
dialog --title "Choose a Slackware version" \
|
||||||
|
--menu "You are currently using sbopkg to browse a local copy of SBo \
|
||||||
|
for Slackware version $SLACKVER. If you would like to change \
|
||||||
|
it, please select another version below:" 20 50 3 \
|
||||||
|
"11.0" "Slackware version 11.0" \
|
||||||
|
"12.0" "Slackware version 12.0" 2>$TMP/sbopkg_version_selection
|
||||||
|
#"12.1" "Slackware version 12.1"
|
||||||
|
if [ $? = 1 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
#exit 0
|
||||||
|
SLACKVER="$(cat $TMP/sbopkg_version_selection)"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
rm -rf $TMP/sbopkg_version_selection
|
||||||
|
}
|
||||||
|
|
||||||
info_item () {
|
info_item () {
|
||||||
# This function shows the menu for each package where the user can see
|
# This function shows the menu for each package where the user can see
|
||||||
# certain information or build the package if he is root
|
# certain information or build the package if he is root
|
||||||
|
@ -284,6 +353,7 @@ rm -rf $TMP/sbopkg_rsync.lck
|
||||||
|
|
||||||
rsync_repo () {
|
rsync_repo () {
|
||||||
# This function does the rsync with SBo.
|
# This function does the rsync with SBo.
|
||||||
|
check_slack_version
|
||||||
check_write $LOCALREPO/$SLACKVER/
|
check_write $LOCALREPO/$SLACKVER/
|
||||||
if [ "$WRITE" = "false" ]; then
|
if [ "$WRITE" = "false" ]; then
|
||||||
if [ "$DIAG" = 1 ]; then
|
if [ "$DIAG" = 1 ]; then
|
||||||
|
@ -314,6 +384,7 @@ search_package () {
|
||||||
# Search for package name and exit if not found. If it is found,
|
# Search for package name and exit if not found. If it is found,
|
||||||
# populate various variables with data about the package for
|
# populate various variables with data about the package for
|
||||||
# displaying information and building.
|
# displaying information and building.
|
||||||
|
cd $LOCALREPO/$SLACKVER
|
||||||
PKG=$1
|
PKG=$1
|
||||||
PKGPATH=$(find -name $PKG)
|
PKGPATH=$(find -name $PKG)
|
||||||
if [ ! $(find -name "$PKG") ]; then
|
if [ ! $(find -name "$PKG") ]; then
|
||||||
|
@ -328,6 +399,7 @@ fi
|
||||||
. $PKGPATH/$PKG.info
|
. $PKGPATH/$PKG.info
|
||||||
PKGNAME=${PKG##*/}
|
PKGNAME=${PKG##*/}
|
||||||
SRCNAME=${DOWNLOAD##*/}
|
SRCNAME=${DOWNLOAD##*/}
|
||||||
|
cd -
|
||||||
}
|
}
|
||||||
|
|
||||||
show_readme () {
|
show_readme () {
|
||||||
|
@ -336,6 +408,7 @@ show_readme () {
|
||||||
# other ways to do this. Perhaps have a way for the user to choose
|
# other ways to do this. Perhaps have a way for the user to choose
|
||||||
# which of the 4 docs he wants to view? Or have a menu listing the 4
|
# which of the 4 docs he wants to view? Or have a menu listing the 4
|
||||||
# docs? Undecided.
|
# docs? Undecided.
|
||||||
|
cd $LOCALREPO/$SLACKVER
|
||||||
${PAGER:-more} $PKGPATH/{README,$PKGNAME.SlackBuild,$PKGNAME.info,\
|
${PAGER:-more} $PKGPATH/{README,$PKGNAME.SlackBuild,$PKGNAME.info,\
|
||||||
slack-desc}
|
slack-desc}
|
||||||
return 0
|
return 0
|
||||||
|
@ -480,13 +553,14 @@ while [ 0 ]; do
|
||||||
dialog --title "SlackBuilds.org Package Browser \
|
dialog --title "SlackBuilds.org Package Browser \
|
||||||
(sbopkg version $VER)" --menu \
|
(sbopkg version $VER)" --menu \
|
||||||
"\nChoose one of the following or press <Cancel> to exit\n" \
|
"\nChoose one of the following or press <Cancel> to exit\n" \
|
||||||
15 60 7 \
|
15 60 8 \
|
||||||
"Rsync" "Rsync with SlackBuilds.org" \
|
"Rsync" "Rsync with SlackBuilds.org" \
|
||||||
"ChangeLog" "View the SlackBuilds.org ChangeLog" \
|
"ChangeLog" "View the SlackBuilds.org ChangeLog" \
|
||||||
"Browse" "Browse the local SlackBuilds.org repo" \
|
"Browse" "Browse the local SlackBuilds.org repo" \
|
||||||
"Search" "Search the local SlackBuilds.org repo" \
|
"Search" "Search the local SlackBuilds.org repo" \
|
||||||
"Cache" "View the contents of the cache directory" \
|
"Cache" "View the contents of the cache directory" \
|
||||||
"Log" "View the permanent build log" \
|
"Log" "View the permanent build log" \
|
||||||
|
"Version" "Select Slackware version (currently: $SLACKVER)" \
|
||||||
"Exit" "Exit sbopkg" 2>$TMP/sbopkg_main_menu_answer
|
"Exit" "Exit sbopkg" 2>$TMP/sbopkg_main_menu_answer
|
||||||
|
|
||||||
if [ $? = 1 ]; then
|
if [ $? = 1 ]; then
|
||||||
|
@ -527,11 +601,15 @@ to search for" 0 0 2>/$TMP/sbopkg_search_request
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$R" = "Cache" ]; then
|
if [ "$R" = "Cache" ]; then
|
||||||
view_cache_dir
|
view_cache_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$R" = "Log" ]; then
|
if [ "$R" = "Log" ]; then
|
||||||
view_perm_log
|
view_perm_log
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$R" = "Version" ]; then
|
||||||
|
select_version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$R" = "Exit" ]; then
|
if [ "$R" = "Exit" ]; then
|
||||||
|
@ -558,7 +636,7 @@ if [ $# -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This is the command line options and help
|
# This is the command line options and help
|
||||||
while getopts ":b:d:f:hlrs:" OPT; do
|
while getopts ":b:d:f:hlrs:v:" OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
b ) BUILD="$OPTARG"
|
b ) BUILD="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
@ -572,6 +650,9 @@ while getopts ":b:d:f:hlrs:" OPT; do
|
||||||
;;
|
;;
|
||||||
s ) SEARCH="$OPTARG"
|
s ) SEARCH="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
v ) VERSION=1
|
||||||
|
CUSTOMVER="$OPTARG"
|
||||||
|
;;
|
||||||
h|* )
|
h|* )
|
||||||
echo
|
echo
|
||||||
echo "$SCRIPT v$VER"
|
echo "$SCRIPT v$VER"
|
||||||
|
@ -589,6 +670,8 @@ ChangeLog.txt and then quit."
|
||||||
echo " the local mirror and then quit."
|
echo " the local mirror and then quit."
|
||||||
echo " -s package Search for a package and, if found, \
|
echo " -s package Search for a package and, if found, \
|
||||||
display package information."
|
display package information."
|
||||||
|
echo " -v version Set the Slackware version for the"
|
||||||
|
echo " mirror (current choices are 11.0 and 12.0)"
|
||||||
echo
|
echo
|
||||||
echo "Note: multiple arguments to -b and -s must be \
|
echo "Note: multiple arguments to -b and -s must be \
|
||||||
quoted (\"pkg1 pkg2\")"
|
quoted (\"pkg1 pkg2\")"
|
||||||
|
@ -601,6 +684,10 @@ shift $(($OPTIND - 1))
|
||||||
|
|
||||||
sanity_checks
|
sanity_checks
|
||||||
|
|
||||||
|
if [ -n "$VERSION" ]; then
|
||||||
|
SLACKVER=$CUSTOMVER
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$BUILD" ]; then
|
if [ -n "$BUILD" ]; then
|
||||||
check_root
|
check_root
|
||||||
if [ $ROOT = "false" ]; then
|
if [ $ROOT = "false" ]; then
|
||||||
|
@ -636,7 +723,8 @@ if [ -n "$CHANGELOG" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$RSYNC" ]; then
|
if [ -n "$RSYNC" ]; then
|
||||||
echo "Rsyncing with Slackbuilds.org repository into $LOCALREPO."
|
echo "Rsyncing with Slackbuilds.org repository into \
|
||||||
|
$LOCALREPO/$SLACKVER."
|
||||||
rsync_repo
|
rsync_repo
|
||||||
cleanup
|
cleanup
|
||||||
echo "Finished rsync."
|
echo "Finished rsync."
|
||||||
|
@ -652,6 +740,10 @@ if [ -n "$SEARCH" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$VERSION" ]; then
|
||||||
|
SLACKVER=$NEWVER
|
||||||
|
fi
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
echo "All done."
|
echo "All done."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH SBOPKG.CONF 5 "Apr 2008" sbopkg-0.0.6 ""
|
.TH SBOPKG.CONF 5 "Apr 2008" sbopkg-SVN ""
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B sbopkg.conf
|
.B sbopkg.conf
|
||||||
\- Configuration file for sbopkg
|
\- Configuration file for sbopkg
|
||||||
|
@ -25,8 +25,8 @@ The default value of RSYNCMIRROR is slackbuilds.org::slackbuilds
|
||||||
.TP 5
|
.TP 5
|
||||||
.B SLACKVER
|
.B SLACKVER
|
||||||
.br
|
.br
|
||||||
This option allows the user to set the Slackware version in order to
|
This option allows the user to set the default Slackware version in
|
||||||
rsync with the matching SBo repository.
|
order to rsync with the matching SBo repository.
|
||||||
|
|
||||||
The default value of SLACKVER is 12.0.
|
The default value of SLACKVER is 12.0.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH SBOPKG 8 "Apr 2008" sbopkg-0.0.6 ""
|
.TH SBOPKG 8 "Apr 2008" sbopkg-SVN ""
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B sbopkg
|
.B sbopkg
|
||||||
\ - The SlackBuilds.org Package Browser
|
\ - The SlackBuilds.org Package Browser
|
||||||
|
@ -88,6 +88,11 @@ Search for PACKAGE(s) and, if found, display the README, SlackBuild,
|
||||||
package is specified, they must be in quotes. For example
|
package is specified, they must be in quotes. For example
|
||||||
"sbopkg -s "foo bar".
|
"sbopkg -s "foo bar".
|
||||||
|
|
||||||
|
.TP 5
|
||||||
|
.B -v VERSION
|
||||||
|
Set the Slackware version to use for the matching local SBo mirror.
|
||||||
|
Current options are 11.0 and 12.0.
|
||||||
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.B /etc/sbopkg/sbopkg.conf
|
.B /etc/sbopkg/sbopkg.conf
|
||||||
\ - File to specify configuration options.
|
\ - File to specify configuration options.
|
||||||
|
|
Loading…
Reference in a new issue