SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
master can be used for stable and development, depending on the situation
when slackware 14.2 is declared stable, a new branch will be made from master called 14.2 and SBo's web will be based on 14.2 branch. At this point, master will be the same as 14.2.
When the development for the next Slackware (let's say 15.0) is on going, we will freeze 14.2 branch and at that point, master will be focusing on packages designed to run in the next release (15.0) while 14.2 branch stays and probably get less update.
Ok, thanks for explaining that to me. So, let's say hypothetically I wanted to use this script right now on 14.1. Is there a git repository dedicated to 14.1 that I can use? (Sorry for the noob questions, I would just like to know where to find these things.)
Ah, that makes sense. I tried "git branch" before posting but it only showed master. I'm not that familiar with working with remote repositories, I guess. But "git checkout 14.1" did work, so I'm all set now.
Last edited by montagdude; 05-01-2016 at 02:36 PM.
Well, I meant to just quietly update this thread in post #14 when I update the script, but I can no longer edit that post. I guess this forum has a time limit on that, which means the note in post 1 is false. (Oh well.) So, I am not intentionally bumping this thread, but I did want to update it since I updated my script. Please ignore if you don't care.
Anyway, this is just a minor update so now the "requires" option also lists the installation status of the required packages of a SlackBuild.
Code:
#!/bin/bash
# Uncomment to use master git repo (for -stable or -current)
REPO=git://slackbuilds.org/slackbuilds.git
BRANCH=master
#BRANCH=14.1
# Uncomment to use Ponce's git repo (for -current only)
#REPO=git://github.com/Ponce/slackbuilds.git
# Local git directory
CDIR=/var/cache/packages/SBo
################################################################################
# Removes quotes around string
function remove_quotes ()
{
local STRING=$1
STRING=${STRING#\"}
STRING=${STRING%\"}
echo $STRING
}
################################################################################
# Gets SlackBuild name from installed package name in /var/log/packages
function get_installed_name ()
{
local PKG=$1
# Get rid of trailing stuff
local BUILD=${PKG%*_SBo}
BUILD=${BUILD%*-*} # Architecture-number
BUILD=${BUILD%*-*} # Architecture
BUILD=${BUILD%*-*} # Version
echo $BUILD
}
################################################################################
# Gets SlackBuild version from installed package name in /var/log/packages
function get_installed_version ()
{
local PKG=$1
# Get rid of trailing stuff
local VERSION=${PKG%*_SBo}
VERSION=${VERSION%*-*} # Architecture-number
VERSION=${VERSION%*-*} # Architecture
# Get rid of leading package name
local TEMP=${VERSION%*-*}
VERSION=${VERSION#$TEMP-*}
echo $VERSION
}
################################################################################
# Gets SlackBuild version from VERSION string in *.info file
function get_current_version ()
{
local BUILD=$1
# Make sure we are at the top of the git tree
cd $CDIR
# Get path of SlackBuild.info
local INFILE=$(find . -maxdepth 3 -mindepth 3 -name "$BUILD".info)
# Get version number from SlackBuild.info
local VERSION=$(grep VERSION "$INFILE" | sed 's/VERSION=//')
VERSION=$(remove_quotes "$VERSION")
echo $VERSION
}
################################################################################
# Checks if Ponce's git repo is being used
function check_ponce_repo ()
{
if [ "$REPO" == "git://github.com/Ponce/slackbuilds.git" ]; then
echo true
else
echo false
fi
}
################################################################################
# Returns the git branch name that is currently being used
function get_git_branch ()
{
# Go to top-level git tree
cd $CDIR
# Parse git status string
local STAT=$(git status | head -1)
local BRANCH=$(echo "$STAT" | cut -d' ' -f3)
echo $BRANCH
}
################################################################################
# Switches to specified git branch
function checkout_git_branch ()
{
local GITBRANCH="$1"
# Go to top-level git tree
cd $CDIR
# Get branch currently being used
local CURRBRANCH=$(get_git_branch)
# Checkout new branch if needed
if [ "$CURRBRANCH" != "$GITBRANCH" ]; then
git checkout $GITBRANCH
fi
}
################################################################################
# Syncs git repo with local copy
function sync_repo ()
{
# Check if Ponce's git repo is being used
local PONCEREPO=$(check_ponce_repo)
# Create local git directory if needed
if [ ! -d "$CDIR" ]; then
mkdir $CDIR
cd $CDIR/../
rm -rf SBo
git clone $REPO SBo
if ! $PONCEREPO; then
cd SBo
checkout_git_branch $BRANCH
fi
# Master branch can just use git pull, but Ponce's must be re-downloaded
# http://www.linuxquestions.org/questions/slackware-14/what-is-the-correct-url-and-command-to-git-clone-slackbuilds-current-4175578557/
rm -rf SBo
git clone $REPO SBo
fi
fi
}
################################################################################
# Checks if a SlackBuild is actually installed. Returns package name if so.
function check_installed ()
{
local BUILD=$1
local PKGLIST=$(find /var/log/packages -maxdepth 1 -name "$BUILD*_SBo")
local INSTALLED=false
# There can be multiple packages fitting the pattern, so loop through them
# and check against requested
if [ "$PKGLIST" != "" ]; then
local PKG=""
local BUILDNAME=""
for PKG in $PKGLIST
do
PKG=$(basename "$PKG")
BUILDNAME=$(get_installed_name "$PKG")
if [ "$BUILDNAME" == "$BUILD" ]; then
INSTALLED=true
break
fi
done
fi
if $INSTALLED; then
echo $PKG
else
echo "Not installed"
fi
}
################################################################################
# Gets y/n choice
function user_choice ()
{
local __MSG=$1
local __CHOICE=$2
local TEMPCHOICE=""
local VALIDCHOICE=false
while ! $VALIDCHOICE
do
echo $__MSG
read TEMPCHOICE
if [[ "$TEMPCHOICE" == "y" || "$TEMPCHOICE" == "Y" ]]; then
TEMPCHOICE="y"
VALIDCHOICE=true
elif [[ "$TEMPCHOICE" == "n" || "$TEMPCHOICE" == "N" ]]; then
TEMPCHOICE="n"
VALIDCHOICE=true
else
echo "Please enter y or n."
fi
done
# This trick is needed to echo to stdout. See usage in remove_slackbuild.
eval $__CHOICE="'$TEMPCHOICE'"
}
################################################################################
# Removes a package with SlackBuild containing a given string
function remove_slackbuild ()
{
local PATTERN=$1
local PKGLIST=$(find /var/log/packages -maxdepth 1 -name "$PATTERN*_SBo")
# Return if no matching packages were found
if [ "$PKGLIST" == "" ]; then
echo "No installed SlackBuilds matching pattern $PATTERN."
# Loop through list of packages matching BUILD string
else
local PKG=""
local CHOICE=""
local MSG=""
for PKG in $PKGLIST
# Ask for confirmation before removing
do
PKG=$(basename "$PKG")
MSG="Found package $PKG. Remove? (y/n): "
user_choice "$MSG" CHOICE
if [ "$CHOICE" == "y" ]; then
removepkg "$PKG"
fi
done
fi
}
################################################################################
# Extracts URLs of source files to download
function sources_from_info ()
{
local INFILE=$1
local SOURCES=""
local ARCH=$(uname -m)
# Read variables from .info file
source $INFILE
# First try to use DOWNLOAD_x86_64 link for 64-bit
if [ "$ARCH" == "x86_64" ]; then
SOURCES=$DOWNLOAD_x86_64
fi
# Use regular DOWNLOAD= line for x86 architecture or if there's no 64-bit
# download
if [[ "$ARCH" != "x86_64" || "$SOURCES" == "" ]]; then
SOURCES=$DOWNLOAD
fi
echo $SOURCES
}
################################################################################
# Extracts MD5sums of source files to download
function md5sums_from_info ()
{
local INFILE=$1
local MD5SUMS=""
local ARCH=$(uname -m)
# Read variables from .info file
source $INFILE
# First try to use MD5SUM_x86_64 link for 64-bit
if [ "$ARCH" == "x86_64" ]; then
MD5SUMS=$MD5SUM_x86_64
fi
# Use regular MD5SUM= line for x86 architecture or if there's no 64-bit
# download
if [[ "$ARCH" != "x86_64" || "$MD5SUMS" == "" ]]; then
MD5SUMS=$MD5SUM
fi
echo $MD5SUMS
}
################################################################################
# Installs or reinstalls SlackBuild
function install_slackbuild ()
{
local BUILD=$1
# Get directory for source files if specified by user
local SOURCEOPT=$2
local SOURCEDIR=${SOURCEOPT#*=}
local SOURCESPEC=${SOURCEOPT%=*}
if [[ "$SOURCEDIR" != "" && "$SOURCESPEC" != "sources" ]]; then
echo "Error: unrecognized command line option. Try sbomgr --help."
return
fi
# Get SlackBuild path
cd $CDIR
local BUILDPATH=$(find . -maxdepth 2 -mindepth 2 -name "$BUILD")
if [ "$BUILDPATH" == "" ]; then
echo "Error: there is no SlackBuild named $BUILD."
return
fi
# Check if SlackBuild is installed on system and get package name
local INSTALLEDPKG=$(check_installed "$BUILD")
# Offer removal or reinstallation if it is already installed
if [ "$INSTALLEDPKG" != "Not installed" ]; then
local INSTALLEDVERSION=$(get_installed_version "$INSTALLEDPKG")
local CURRENTVERSION=$(get_current_version "$BUILD")
local MSG=""
local CHOICE=""
# Current version already installed - ask for reinstallation
if [ "$INSTALLEDVERSION" == "$CURRENTVERSION" ]; then
MSG="$BUILD is already at the most recent version. Reinstall? (y/n): "
# Installed version out of date - ask for reinstallation
else
MSG="$BUILD is already installed but out of date. Reinstall? (y/n): "
fi
# Remove package or return
user_choice "$MSG" CHOICE
if [ "$CHOICE" == "y" ]; then
removepkg $INSTALLEDPKG
else
return
fi
fi
# Remove any package in /tmp with $BUILD in the name (could mess up
# installation later)
local PKG=$(find /tmp -maxdepth 1 -name "*$BUILD*")
if [ "$PKG" != "" ]; then
rm $PKG
fi
# Go to SlackBuild directory
cd $BUILDPATH
# Get MD5sums for source downloads and put them into an array
local MD5SUMS=$(md5sums_from_info "$BUILD".info)
local MD5ARRAY=""
local ITEM=""
local COUNT=0
for ITEM in $MD5SUMS
do
MD5ARRAY["$COUNT"]=$ITEM
let "COUNT+=1"
done
# Download or copy sources
local SOURCES=$(sources_from_info "$BUILD".info)
local CHKDNLD=""
local MD5CHK=""
COUNT=0
for SOURCE in $SOURCES
do
if [ -f "$SOURCE" ]; then
rm "$SOURCE"
fi
# Copy sources from specified directory
if [ "$SOURCEDIR" != "" ]; then
SOURCE=$(basename "$SOURCE")
if [ "$(find "$SOURCEDIR" -maxdepth 1 -name "$SOURCE")" == "" ]; then
echo "Error: source file $SOURCE not present in $SOURCEDIR."
return
else
cp "$SOURCEDIR/$SOURCE" .
fi
# Download and check for error ($? is the return value)
else
CHKDNLD=$(wget "$SOURCE")
if [ $? != 0 ]; then
echo "There was an error downloading the source file."
return
fi
fi
# Check MD5sum
SOURCE=$(basename "$SOURCE")
MD5CHK=$(md5sum "$SOURCE")
MD5CHK=$(echo $MD5CHK | cut -d' ' -f1)
if [ "$MD5CHK" != "${MD5ARRAY[$COUNT]}" ]; then
echo "Error: md5sum check failed on $SOURCE."
return
fi
let "COUNT+=1"
done
# Execute install script
chmod +x $BUILD.SlackBuild
./$BUILD.SlackBuild
# Exit if not successful
PKG=$(find /tmp -maxdepth 1 -name "*$BUILD*")
if [ "$PKG" == "" ]; then
echo "An error occurred. $BUILD was not installed."
return
fi
# Install compiled package
installpkg $PKG
# Remove temporary files and source code
rm $PKG
for SOURCE in $SOURCES
do
rm $(basename "$SOURCE")
done
}
################################################################################
# Checks for update of specified Slackbuild
function check_update ()
{
local BUILD=$1
# Check first if it is installed and get installed version
local INSTALLEDPKG=$(check_installed "$BUILD")
if [ "$INSTALLEDPKG" == "Not installed" ]; then
echo "$BUILD is not installed."
return
else
local INSTALLEDVERSION=$(get_installed_version "$INSTALLEDPKG")
fi
# Go to top-level git directory
cd $CDIR
# Check if SlackBuild exists and get current version
BUILDPATH=$(find . -maxdepth 2 -mindepth 2 -name "$BUILD")
if [ "$BUILDPATH" == "" ]; then
echo "Error: there is no SlackBuild named $BUILD."
return
fi
local CURRENTVERSION=$(get_current_version "$BUILD")
# Compare version
if [ "$INSTALLEDVERSION" == "$CURRENTVERSION" ]; then
echo "$BUILD is up to date."
else
echo "$BUILD can be updated."
echo "Installed version: $INSTALLEDVERSION"
echo "Current version: $CURRENTVERSION"
fi
}
################################################################################
# Checks all installed SlackBuilds for updates
function check_all_updates ()
{
# Get list of installed SlackBuilds
local PKGLIST=$(find /var/log/packages -maxdepth 1 -name "*_SBo")
# Loop through installed packages and check for updates
local PKG=""
local BUILD=""
local INSTALLEDVERSION=""
local CURRENTVERSION=""
local UPDATELIST=""
local UPTODATELIST=""
local UPDATECOUNT=0
local UPTODATECOUNT=0
local INSTALLEDVERSIONLIST=""
local CURRENTVERSIONLIST=""
for PKG in $PKGLIST
do
PKG=$(basename "$PKG")
# Get SlackBuild name and version
BUILD=$(get_installed_name "$PKG")
INSTALLEDVERSION=$(get_installed_version "$PKG")
# Get current version
CURRENTVERSION=$(get_current_version "$BUILD")
# Compare versions and tally up-to-date and out-of-date
if [ "$INSTALLEDVERSION" == "$CURRENTVERSION" ]; then
UPTODATELIST["$UPTODATECOUNT"]="$BUILD"
let "UPTODATECOUNT+=1"
else
UPDATELIST["$UPDATECOUNT"]="$BUILD"
INSTALLEDVERSIONLIST["$UPDATECOUNT"]="$INSTALLEDVERSION"
CURRENTVERSIONLIST["$UPDATECOUNT"]="$CURRENTVERSION"
let "UPDATECOUNT+=1"
fi
done
# Print a summary
echo ""
echo "$UPTODATECOUNT SlackBuilds are up-to-date."
echo "-----------------------------------------------------------------------"
local I=0
while [ $I -lt $UPTODATECOUNT ];
do
echo "Name: ${UPTODATELIST[$I]}"
let "I+=1"
done
echo ""
echo "$UPDATECOUNT SlackBuilds are can be updated."
echo "-----------------------------------------------------------------------"
I=0
while [ $I -lt $UPDATECOUNT ];
do
echo "Name: ${UPDATELIST[$I]}"
echo "Installed version: ${INSTALLEDVERSIONLIST[$I]}"
echo "Current version: ${CURRENTVERSIONLIST[$I]}"
echo ""
let "I+=1"
done
}
################################################################################
# Lists dependencies of specified SlackBuild by scanning .info file
function list_reqs ()
{
local BUILD=$1
echo ""
echo "Note: only checks status of level 0 dependencies; dependencies of "
echo "dependencies are not checked."
echo ""
# Get the directory for the requested SlackBuild
local BUILDPATH=$(find "$CDIR" -maxdepth 2 -mindepth 2 -name "$BUILD")
if [ "$BUILDPATH" == "" ]; then
echo "There is no SlackBuild named $BUILD."
return
fi
# Read dependencies from *.info file
cd $BUILDPATH
source "$BUILD".info
if [ "$REQUIRES" != "" ]; then
echo "Requirements of $BUILD:"
local DEP=""
local STATUS=""
for DEP in $REQUIRES
do
if [ "$(check_installed $DEP)" != "Not installed" ]; then
STATUS="installed"
else
STATUS="not installed"
fi
echo "$DEP [$STATUS]"
done
else
echo "No required packages for $BUILD."
fi
}
################################################################################
# Lists installed SlackBuilds that require specified SlackBuild
function list_inv_reqs ()
{
local BUILD=$1
# Loop through list of installed packages
local PKGLIST=$(find /var/log/packages -maxdepth 1 -name "*_SBo")
local PKG=""
local NAME=""
local BUILDPATH=""
local INVREQLIST=""
local INVREQCOUNT=0
local REQ=""
for PKG in $PKGLIST
do
# Go to top of git tree
cd $CDIR
# Go to directory of requested SlackBuild
PKG=$(basename "$PKG")
NAME=$(get_installed_name "$PKG")
BUILDPATH=$(find . -maxdepth 2 -mindepth 2 -name "$NAME")
cd $BUILDPATH
# Read requirements from *.info file
source "$NAME".info
# Loop through and see if specified SlackBuild is mentioned
if [ "$REQUIRES" != "" ]; then
for REQ in $REQUIRES
do
if [ "$REQ" == "$BUILD" ]; then
INVREQLIST["$INVREQCOUNT"]="$NAME"
let "INVREQCOUNT+=1"
break
fi
done
fi
done
# List SlackBuilds that require specified SlackBuild
if [ $INVREQCOUNT -eq 0 ]; then
echo "No installed SlackBuilds require $BUILD."
else
echo "The following SlackBuilds require $BUILD:"
local I=0
while [ $I -lt $INVREQCOUNT ]
do
echo "${INVREQLIST[$I]}"
let "I+=1"
done
fi
}
################################################################################
# Shows info from README and README.SLACKWARE
function show_info ()
{
local BUILD=$1
# Go to the top of the git tree
cd $CDIR
# Get the directory for the requested SlackBuild
echo "Searching for $BUILD ..."
local BUILDPATH=$(find . -maxdepth 2 -mindepth 2 -name "$BUILD")
if [ "$BUILDPATH" == "" ]; then
echo "There is no SlackBuild named $BUILD."
return
fi
# Go the the SlackBuild directory
cd $BUILDPATH
BUILDPATH=${BUILDPATH#./*}
local NAME=${BUILDPATH#*/*}
# Get current version
local VERSION=$(get_current_version "$NAME")
echo "In local git repository:"
echo "$NAME-$VERSION"
echo ""
echo "-----------------------------Description-----------------------------"
cat 'README'
if [ -f 'README.Slackware' ]; then
echo ""
echo "---------------------------Slackware notes---------------------------"
cat 'README.Slackware'
elif [ -f 'README.SLACKWARE' ]; then
echo ""
echo "---------------------------Slackware notes---------------------------"
cat 'README.SLACKWARE'
fi
}
################################################################################
# Searches for SlackBuilds with given pattern
function search ()
{
local PATTERN=$1
# Go to the top of the git tree
cd $CDIR
echo "Searching for $PATTERN ..."
local BUILDS=$(find . -maxdepth 2 -mindepth 2 -type d | grep -i "$PATTERN")
if [ "$BUILDS" == "" ]; then
echo "There is no SlackBuild matching the pattern $PATTERN."
else
# Get GROUP/NAME/STATUS
local BUILD=""
local STATUS=""
for BUILD in $BUILDS
do
BUILD=${BUILD#./*}
local GROUP=${BUILD%/*}
local NAME=${BUILD#*/*}
if [ "$(check_installed $NAME)" != "Not installed" ]; then
STATUS="installed"
else
STATUS="not installed"
fi
echo "$GROUP/$NAME [$STATUS]"
done
fi
}
################################################################################
# Searches README files for given pattern
function search_descriptions ()
{
# Make sure spaces in the search string are resolved
local PATTERN="$*"
# Go to the top of the git tree
cd $CDIR
echo "Searching README files for $PATTERN ..."
local PTRNFILES=$(find . -maxdepth 3 -mindepth 3 -name README | xargs grep -il "$PATTERN" | sort -t "/" -k 3)
# Display list of SlackBuilds
if [ "$PTRNFILES" != "" ]; then
echo "The following SlackBuilds have $PATTERN in the README file:"
local BUILD=""
for BUILD in $PTRNFILES
do
BUILD=${BUILD#./*/*} # Remove leading ./ and group
BUILD=${BUILD%*/*} # Remove trailing /README
echo $BUILD
done
else
echo "No SlackBuilds have $PATTERN in the README file."
fi
}
################################################################################
# Lists installed SlackBuilds and versions
function list_installed ()
{
local PKGLIST=$(find /var/log/packages -maxdepth 1 -name "$BUILD*_SBo" | sort)
# Loop through installed packages and list name-version
local PKG=""
for PKG in $PKGLIST
do
echo $(basename "$PKG")
done
}
################################################################################
# Lists groups in git tree
function list_groups ()
{
# Go to top-level git tree
cd $CDIR
# Print list of groups
local GROUPLIST=$(find . -maxdepth 1 -type d | sort)
local GROUP=""
for GROUP in $GROUPLIST
do
if [[ "$GROUP" != "." && "$GROUP" != "./.git" ]]; then
echo ${GROUP#./*}
fi
done
}
################################################################################
# Browses SlackBuilds in requested group
function browse_group ()
{
local GROUP=$1
# Go to top-level git tree
cd $CDIR
# Check if group exists
if [ ! -d $GROUP ]; then
echo "No group called $GROUP."
return
fi
# List packages in GROUP
cd $GROUP
local PKGLIST=$(find . -maxdepth 1 -type d | sort)
local PKG=""
for PKG in $PKGLIST
do
if [ "$PKG" != "." ]; then
echo ${PKG#./*}
fi
done
}
################################################################################
# Provides info on program usage
function print_usage ()
{
echo ""
if [ $# -eq 1 ]; then
echo "Error: $1"
fi
echo "Usage: sbomgr OPTIONS"
echo ""
echo "OPTIONS"
echo " sync-repo Syncs git repo with local copy. Use"
echo " before updating."
echo ""
echo " install SLACKBUILD Installs or reinstalls the specified"
echo " SlackBuild."
echo ""
echo " install SLACKBUILD sources=DIRECTORY"
echo " Copies source code from specified"
echo " directory instead of downloading."
echo ""
echo " remove PATTERN Optionally removes installed SlackBuilds"
echo " matching PATTERN."
echo ""
echo " check-update SLACKBUILD"
echo " Checks the specified SlackBuild for"
echo " updates."
echo ""
echo " check-all-updates Checks all installed SlackBuilds for"
echo " updates."
echo ""
echo " requires SLACKBUILD Lists level 0 packages required by the"
echo " specified SlackBuild and installed"
echo " status."
echo ""
echo " requirement-of SLACKBUILD"
echo " Lists installed SlackBuilds that depend"
echo " on the specified SlackBuild."
echo ""
echo " search PATTERN Searches for SlackBuilds matching PATTERN"
echo " in git tree. Shows installed status."
echo ""
echo " search-descriptions PATTERN"
echo " Searches README files in git tree for"
echo " specified pattern."
echo ""
echo " info SLACKBUILD Displays info about the SlackBuild from"
echo " README and README.SLACKWARE."
echo ""
echo " list-installed Lists installed SlackBuilds and versions."
echo ""
echo " list-groups Lists groups in git tree."
echo ""
echo " browse-group GROUP Lists SlackBuilds in specified GROUP."
echo ""
echo " --help Shows this usage information."
echo ""
}
################################################################################
# Main program
# Not enough command line arguments
if [ $# -lt 1 ]; then
print_usage "must specify an option."
# sync-repo
elif [ "$1" == "sync-repo" ]; then
sync_repo
# install SLACKBUILD and
# install SLACKBUILD sources={DIRECTORY}
elif [ "$1" == "install" ]; then
if [ $# -eq 1 ]; then
print_usage "must specify SlackBuild with install option."
else
if [ $# -eq 2 ]; then
install_slackbuild $2
else
install_slackbuild $2 $3
fi
fi
# remove PATTERN
elif [ "$1" == "remove" ]; then
if [ $# -eq 1 ]; then
print_usage "must specify PATTERN with remove option."
else
remove_slackbuild $2
fi
# check-update SLACKBUILD
elif [ "$1" == "check-update" ]; then
if [ $# -eq 1 ]; then
print_usage "must specify a SlackBuild with update option."
else
check_update $2
fi
# check-all-updates
elif [ "$1" == "check-all-updates" ]; then
check_all_updates
# requires SLACKBUILD
elif [ "$1" == "requires" ]; then
if [ $# -lt 2 ]; then
print_usage "must specify a SlackBuild with requires option."
else
list_reqs $2
fi
# requirement-of SLACKBUILD
elif [ "$1" == "requirement-of" ]; then
if [ $# -lt 2 ]; then
print_usage "must specify a SlackBuild with requirement-of option."
else
list_inv_reqs $2
fi
# search PATTERN
elif [ "$1" == "search" ]; then
if [ $# -lt 2 ]; then
print_usage "must specify PATTERN with search option."
else
search $2
fi
# search-descriptions PATTERN
elif [ "$1" == "search-descriptions" ]; then
if [ $# -lt 2 ]; then
print_usage "must specify PATTERN with search-descriptions option."
else
search_descriptions $2
fi
# info SLACKBUILD
elif [ "$1" == "info" ]; then
if [ $# -lt 2 ]; then
print_usage "must specify a SlackBuild with info option."
else
show_info $2
fi
# list-installed
elif [ "$1" == "list-installed" ]; then
list_installed
# list-groups
elif [ "$1" == "list-groups" ]; then
list_groups
# browse-group GROUP
elif [ "$1" == "browse-group" ]; then
if [ $# -lt 2 ]; then
print_usage "must specify a SlackBuild with browse-group option."
else
browse_group $2
fi
# --help
elif [ "$1" == "--help" ]; then
print_usage
# Unrecognized option
else
print_usage "unrecognized option."
fi
I decided that it makes more sense to put this on GitHub instead of storing it here. The repository is at https://github.com/montagdude/sbomgr. I won't be updating this thread any longer when the script gets updated. Just as a last update here though, here's what has changed since the last post:
Automatically check and notify if README.SLACKWARE or README.Slackware exists after installing.
git checkout $BUILD.SlackBuild (only change was to make it executable) in working directory after installing so that local git repository doesn't retain this change.
Change the name of 'sync-repo' option to 'update'; change 'check-update' to 'check-upgrade'; change 'check-all-updates' to 'check-all-upgrades'.
Last edited by montagdude; 05-21-2016 at 09:10 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.