Commit f92e07f0 authored by PoroCYon's avatar PoroCYon
Browse files

fix _

parent da4b6788
......@@ -2,6 +2,9 @@ sources/*
local/lib/*
local/share/*
local/include
local/bin/o*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
......
......@@ -133,8 +133,8 @@ export -f exec_subcommand
ISSUBCMD=""
parse_arg() {
case $1 in
-c|--config)
case "$1" in
"-c"|"--config")
if [ $# -lt 2 ]; then
(>&2 echo "No config file path given.")
exit_cleanup 1
......@@ -143,20 +143,19 @@ parse_arg() {
SSPT_CONFIG_FILE="$2"
return 2
;;
-h|--help|-?)
"-h"|"--help"|"-?")
print_help
;;
# TODO: -V is borked?
-V|--version)
"-V"|"--version")
print_version
;;
--list-subcommands|--list|-L)
"--list-subcommands"|"--list"|"-L")
load_config
while read -r sc; do
basename "$sc"
done <<< "$(find "$SSPT_SUB_DIR/" -type f -name "sspt-*")"
;;
--mk-default-config)
"--mk-default-config")
if ! [ -d "$CONFIG_PATH" ]; then
mkdir -p "$CONFIG_PATH"
fi
......
......@@ -584,11 +584,11 @@ autogen_cwd() {
main() {
local ESCAPED_PKG=$(escape_string "$1")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
-e|--edit)
"-e"|"--edit")
if [ -z "$2" ]; then
print_help
exit
......
......@@ -22,16 +22,16 @@ EOF
main() {
local ESCAPED_PKG=$(escape_string "$2")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
exists)
"exists")
if [ $# -lt 2 ]; then print_help; exit 1; fi
grep -E -q -e "^$ESCAPED_PKG$" < "$SSPT_BIN_DB_FILE"
return $?
;;
reg|register)
"reg"|"register")
if [ $# -lt 3 ]; then print_help; exit 1; fi
if ! [ -f "$3" ]; then print_help; exit 1; fi
......@@ -49,7 +49,7 @@ main() {
cp "$3" "$SSPT_BIN_DB_DIR/$ESCAPED_PKG"
fi
;;
unreg|unregister)
"unreg"|"unregister")
if [ $# -lt 2 ]; then print_help; exit 1; fi
if grep -E -q -e "^$ESCAPED_PKG$" < "$SSPT_BIN_DB_FILE"; then
......
......@@ -14,11 +14,11 @@ EOF
DO_CONFIG='auto'
main() {
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
-c|--configure)
"-c"|"--configure")
DO_CONFIG='y'
local ALLARGS=("$@")
main "${ALLARGS[@]:1}"
......@@ -31,7 +31,7 @@ main() {
fi
if [ "$DO_CONFIG" = "y" ]; then
exec_subcommand pkgcmd configure "$1"
exec_subcommand pkgcmd config "$1"
fi
exec_subcommand pkgcmd build "$1"
......
......@@ -12,8 +12,8 @@ EOF
}
main() {
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -12,8 +12,8 @@ EOF
}
main() {
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -12,8 +12,8 @@ EOF
}
main() {
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -14,8 +14,8 @@ EOF
main() {
local ESCAPED_PKG=$(escape_string "$1")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -21,23 +21,23 @@ DO_CCFG='auto'
main() {
local ALLARGS=("$@")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
-f|--configure)
"-f"|"--configure")
DO_CONF='y'
main "${ALLARGS[@]:1}"
;;
-b|--build)
"-b"|"--build")
DO_BUILD='y'
main "${ALLARGS[@]:1}"
;;
-c|--clean)
"-c"|"--clean")
DO_CLEAN='y'
main "${ALLARGS[@]:1}"
;;
-C|--clean-cfg)
"-C"|"--clean-cfg")
DO_CLEAN='y'
DO_CCFG='y'
main "${ALLARGS[@]:1}"
......
......@@ -19,8 +19,8 @@ main() {
exit
fi
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -21,8 +21,8 @@ main() {
local ESCAPED_PKG=$(escape_string "$2")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -35,29 +35,29 @@ pull_with_vcs() {
return
fi
case $1 in
git)
case "$1" in
"git")
git clone --recursive "$2" "$SSPT_DL_DIR/$PKG_NAME"
;;
hg)
"hg")
hg clone "$2" "$SSPT_DL_DIR/$PKG_NAME"
;;
svn)
"svn")
svn co "$2" "$SSPT_DL_DIR/$PKG_NAME"
;;
cvs)
"cvs")
cvs -z3 -d"$2" co "$SSPT_DL_DIR/$PKG_NAME"
;;
bzr)
"bzr")
bzr branch "$2" "$SSPT_DL_DIR/$PKG_NAME"
;;
mtn)
"mtn")
mtn --db=mtn.db clone "$2" -b "$PKG_NAME" "${PKG_NAME##*.}"
;;
darcs)
"darcs")
darcs clone "$2" "$SSPT_DL_DIR/$PKG_NAME"
;;
http)
"http")
if command -v "wget" >/dev/null 2>&1; then
wget "$2" -q -O "/tmp/$PKG_NAME"
elif command -v "curl" >/dev/null 2>&1; then
......@@ -73,7 +73,7 @@ pull_with_vcs() {
unar -D "/tmp/$PKG_NAME" -o "$SSPT_DL_DIR/$PKG_NAME"
rm "/tmp/$PKG_NAME"
;;
rsync)
"rsync")
rsync "$1" "/tmp/$PKG_NAME"
if ! [ -d "$SSPT_DL_DIR/$PKG_NAME" ]; then
mkdir -p "$SSPT_DL_DIR/$PKG_NAME"
......@@ -98,63 +98,63 @@ main() {
fi
case $1 in
-h|-?|--help)
"-h"|"-?"|"--help")
print_help
;;
-n|--no-autogen)
"-n"|"--no-autogen")
DO_AUTOGEN='n'
main "${ALL_ARGS[@]:1}"
exit
;;
-f|--force-autogen)
"-f"|"--force-autogen")
DO_AUTOGEN='y'
main "${ALL_ARGS[@]:1}"
exit
;;
-e|--edit)
"-e"|"--edit")
DO_EDIT='y'
main "${ALL_ARGS[@]:1}"
exit
;;
-b|--build)
"-b"|"--build")
DO_BUILD='y'
main "${ALL_ARGS[@]:1}"
exit
;;
-i|--install)
"-i"|"--install")
DO_BUILD='y'
DO_INSTALL='y'
main "${ALL_ARGS[@]:1}"
exit
;;
--*)
"--"*)
pull_with_vcs "${1:2}" "$2"
;;
git*|*.git|*github*|*gitlab*|*git.savannah*|*gogs*|://git.*|:git.*)
"git"*|*".git"|*"github"*|*"gitlab"*|*"git.savannah"*|*"gogs"*|"://git."*|":git."*)
pull_with_vcs git "$1"
;;
hg*|*hg.savannah*|://hg.*|://mercurial.*|:hg.*|:mercurial.*)
"hg"*|*"hg.savannah"*|"://hg."*|"://mercurial."*|":hg."*|":mercurial."*)
pull_with_vcs hg "$1"
;;
svn*|*svn.savannah*|://svn.*|:svn.*)
"svn"*|*"svn.savannah"*|"://svn."*|":svn."*)
pull_with_vcs svn "$1"
;;
cvs*|*cvs.savannah*|://cvs.*|:cvs.*)
"cvs"*|*"cvs.savannah"*|"://cvs."*|":cvs."*)
pull_with_vcs cvs "$1"
;;
bzr*|*bzr.savannah*|://bzr.*|:bzr.*)
"bzr"*|*"bzr.savannah"*|"://bzr."*|":bzr."*)
pull_with_vcs bzr "$1"
;;
mtn*|://mtn.*|:mtn.*)
"mtn"*|"://mtn."*|":mtn."*)
pull_with_vcs mtn "$1"
;;
darcs*|*hub.darcs*|://darcs.*|:darcs.*)
"darcs"*|*"hub.darcs"*|"://darcs."*|":darcs."*)
pull_with_vcs darcs "$1"
;;
http*.tar|http*.tar.*|http*.zip|http*.7z)
"http"*".tar"|"http"*".tar."*|"http"*".zip"|"http"*".7z")
pull_with_vcs http "$1"
;;
rsync:*)
"rsync:"*)
pull_with_vcs rsync "$1"
;;
*)
......
......@@ -14,8 +14,8 @@ EOF
main() {
local ESCAPED_PKG=$(escape_string "$1")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -25,16 +25,16 @@ main() {
ESCAPED_PKG=$(escape_string "$2")
fi
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
exists)
"exists")
if [ $# -lt 2 ]; then print_help; exit 1; fi
grep -E -q -e "^$ESCAPED_PKG " < "$SSPT_SRC_DB_FILE"
return $?
;;
reg|register)
"reg"|"register")
if [ $# -lt 3 ]; then print_help; exit 1; fi
# check whether package exists
......@@ -50,7 +50,7 @@ main() {
mv "$TMPFILE" "$SSPT_SRC_DB_FILE"
fi
;;
unreg|unregister)
"unreg"|"unregister")
if [ $# -lt 2 ]; then print_help; exit 1; fi
if grep -E -q -e "^$ESCAPED_PKG " < "$SSPT_SRC_DB_FILE"; then
......
......@@ -53,16 +53,16 @@ run_strace() {
local OUTFIL=""
case "$SYSCALL" in
open|creat|mkdir|rmdir|symlink)
"open"|"creat"|"mkdir"|"rmdir"|"symlink")
OUTFIL="${ALLARGS[0]}"
;;
openat|link|mkdirat|rename)
"openat"|"link"|"mkdirat"|"rename")
OUTFIL="${ALLARGS[1]}"
;;
symlinkat)
"symlinkat")
OUTFIL="${ALLARGS[2]}"
;;
linkat|renameat|renameat2)
"linkat"|"renameat"|"renameat2")
OUTFIL="${ALLARGS[3]}"
;;
*)
......@@ -79,8 +79,8 @@ run_strace() {
}
main() {
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
exit
;;
......
......@@ -31,8 +31,8 @@ remove_empty_dir_rec() {
main() {
local ESCAPED_PKG=$(escape_string "$1")
case $1 in
-h|-?|--help)
case "$1" in
"-h"|"-?"|"--help")
print_help
;;
*)
......
......@@ -38,6 +38,7 @@ upgrade_package() {
exec_subcommand install "$1"
}
upgrade_pkgs() {
# TODO: speed this up, maybe by parallellising this?
while read -r PKG; do
upgrade_package "$PKG"
done < "/tmp/upgrade_list"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment