swish-e indexing change and whoami cleanup

swish-e now creates a .swishrc config file inside the tomb so that
users can tweak its configuration by hand.
whoami() is also cleaned up, pending a fix for slackware usage.
This commit is contained in:
Jaromil 2014-11-23 21:53:44 +01:00
parent 2480c89210
commit a6a784f1ef

25
tomb
View File

@ -168,14 +168,12 @@ _cat() { local -a _arr;
# Also update USERNAME and HOME to maintain consistency. # Also update USERNAME and HOME to maintain consistency.
_whoami() { _whoami() {
# Set global variables
typeset -gi _GID _UID
typeset -g _TTY _USER
# Set username from UID or environment # Set username from UID or environment
[[ -n $SUDO_USER ]] && _USER=$SUDO_USER _USER=$SUDO_USER
[[ -z $_USER && -n $USERNAME ]] && _USER=$USERNAME [[ "$_USER" = "" ]] && { _USER=$USERNAME }
[[ -z $_USER ]] && _USER=$(id -u) [[ "$_USER" = "" ]] && { _USER=$(id -u) }
[[ "$_USER" = "" ]] && {
_failure "Failing to identify the user who is calling us" }
# Get GID from option -G or the environment # Get GID from option -G or the environment
option_is_set -G \ option_is_set -G \
@ -2051,10 +2049,9 @@ index_tombs() {
# here we use swish to index file contents # here we use swish to index file contents
[[ $SWISH == 1 ]] && { [[ $SWISH == 1 ]] && {
_message "Indexing ::1 tomb name:: contents..." $tombname _message "Indexing ::1 tomb name:: contents..." $tombname
_tmp_create [[ -r ${tombmount}/.swishrc ]] || {
local swishrc=$TOMBTMP _message "Generating a new swish-e configuration file: ::1 swish conf::" ${tombmount}/.swishrc
cat <<EOF > ${tombmount}/.swishrc
cat <<EOF > $swishrc
# index directives # index directives
DefaultContents TXT* DefaultContents TXT*
IndexDir $tombmount IndexDir $tombmount
@ -2121,10 +2118,10 @@ FileFilterMatch unoconv "-d document -f txt --stdout %P" /\.tex$/i
IndexContents HTML* .htm .html .shtml IndexContents HTML* .htm .html .shtml
IndexContents XML* .xml IndexContents XML* .xml
EOF EOF
}
swish-e -c ${tombmount}/.swishrc -S fs -v3
_verbose "Using swish-e to create index."
swish-e -c $swishrc -S fs -v3
rm -f $swishrc
} }
_message "Search index updated." _message "Search index updated."