5 Commits
0.3 ... 0.4

Author SHA1 Message Date
emmett1
9a06fbd474 fix pkgadd 2020-02-19 17:03:24 +08:00
emmett1
7a91fbdcd4 replace type with command 2020-02-19 15:23:42 +08:00
emmett1
00e55a2473 replace type with command 2020-02-19 00:39:34 +08:00
emmett1
0ee256b921 fix 2020-02-17 23:58:18 +08:00
emmett1
424c56f075 fix typo 2020-02-12 23:48:17 +08:00
5 changed files with 22 additions and 21 deletions

3
pkgadd
View File

@@ -140,7 +140,7 @@ LOCK_FILE="$SCRATCHPKG_DIR/spkg.lock"
}
[ -d "$ROOT_DIR/$INDEX_DIR" ] || {
msgerr "Package's database directory not exist! ($ROOT_DIR$/INDEX_DIR)"
msgerr "Package's database directory not exist! ($ROOT_DIR/$INDEX_DIR)"
ret 1
}
@@ -154,6 +154,7 @@ LOCK_FILE="$SCRATCHPKG_DIR/spkg.lock"
[ -f "$ROOT_DIR/$LOCK_FILE" ] && {
msgerr "Cant install/remove package simultaneously."
msgerr "remove '$ROOT_DIR/$LOCK_FILE' if no install/remove package process running."
exit 1
}
touch "$ROOT_DIR/$LOCK_FILE" 2>/dev/null || {

View File

@@ -158,7 +158,7 @@ prepare_src() {
if [ "$FILENAME" != "$FILE" ] && [ "$nxt" != 1 ]; then
case $FILENAME in
*.tar|*.tar.gz|*.tar.Z|*.tgz|*.tar.bz2|*.tbz2|*.tar.xz|*.txz|*.tar.lzma|*.zip|*.rpm)
if [ $(type -p bsdtar) ]; then
if [ $(command -v bsdtar) ]; then
COMMAND="bsdtar -p -o -C $SRC -xf $FILENAME"
else
COMMAND="tar -p -o -C $SRC -xf $FILENAME"
@@ -415,7 +415,7 @@ check_buildscript() {
elif [ -z "$release" ]; then
msgerr "'release' is empty!"
exit 1
elif [ "$(type -t build)" != "function" ]; then
elif [ ! "$(command -v build)" ]; then
msgerr "'build' function not exist!"
exit 1
elif echo "$version" | grep -q '-'; then

View File

@@ -350,7 +350,7 @@ fi
shift
if [ $(type -t pkg_$opts) ]; then
if [ $(command -v pkg_$opts) ]; then
pkg_$opts "$@"
else
print_runhelp_msg

32
scratch
View File

@@ -133,7 +133,7 @@ confirm() {
}
checktool() {
if ! type -p $1 >/dev/null; then
if ! command -v $1 >/dev/null; then
msgerr "'$1' not exist in your system!"
exit 1
fi
@@ -286,37 +286,37 @@ post_triggers() {
done
fi
if [ "$trig_11" = 1 ] && [ $(type -p fc-cache) ]; then
if [ "$trig_11" = 1 ] && [ $(command -v fc-cache) ]; then
echo "trigger: Updating fontconfig cache..."
fc-cache -s
fi
if [ "$trig_10" = 1 ] && [ $(type -p gdk-pixbuf-query-loaders) ]; then
if [ "$trig_10" = 1 ] && [ $(command -v gdk-pixbuf-query-loaders) ]; then
echo "trigger: Probing GDK-Pixbuf loader modules..."
gdk-pixbuf-query-loaders --update-cache
fi
if [ "$trig_9" = 1 ] && [ $(type -p gio-querymodules) ]; then
if [ "$trig_9" = 1 ] && [ $(command -v gio-querymodules) ]; then
echo "trigger: Updating GIO module cache..."
gio-querymodules /usr/lib/gio/modules
fi
if [ "$trig_8" = 1 ] && [ $(type -p glib-compile-schemas) ]; then
if [ "$trig_8" = 1 ] && [ $(command -v glib-compile-schemas) ]; then
echo "trigger: Compiling GSettings XML schema files..."
glib-compile-schemas /usr/share/glib-2.0/schemas
fi
if [ "$trig_7" = 1 ] && [ $(type -p gtk-query-immodules-2.0) ]; then
if [ "$trig_7" = 1 ] && [ $(command -v gtk-query-immodules-2.0) ]; then
echo "trigger: Probing GTK2 input method modules..."
gtk-query-immodules-2.0 --update-cache
fi
if [ "$trig_6" = 1 ] && [ $(type -p gtk-query-immodules-3.0) ]; then
if [ "$trig_6" = 1 ] && [ $(command -v gtk-query-immodules-3.0) ]; then
echo "trigger: Probing GTK3 input method modules..."
gtk-query-immodules-3.0 --update-cache
fi
if [ "$trig_5" = 1 ] && [ $(type -p gtk-update-icon-cache) ]; then
if [ "$trig_5" = 1 ] && [ $(command -v gtk-update-icon-cache) ]; then
echo "trigger: Updating icon theme caches..."
for dir in /usr/share/icons/* ; do
if [ -e $dir/index.theme ]; then
@@ -328,12 +328,12 @@ post_triggers() {
done
fi
if [ "$trig_4" = 1 ] && [ $(type -p udevadm) ]; then
if [ "$trig_4" = 1 ] && [ $(command -v udevadm) ]; then
echo "trigger: Updating hardware database..."
udevadm hwdb --update
fi
if [ "$trig_3" = 1 ] && [ $(type -p mkfontdir) ] && [ $(type -p mkfontscale) ]; then
if [ "$trig_3" = 1 ] && [ $(command -v mkfontdir) ] && [ $(command -v mkfontscale) ]; then
echo "trigger: Updating X fontdir indices..."
for dir in $(find /usr/share/fonts -maxdepth 1 -type d \( ! -path /usr/share/fonts -a ! -name X11 \)) /usr/share/fonts/X11/*; do
rm -f $dir/fonts.scale $dir/fonts.dir $dir/.uuid
@@ -344,12 +344,12 @@ post_triggers() {
done
fi
if [ "$trig_2" = 1 ] && [ $(type -p update-desktop-database) ]; then
if [ "$trig_2" = 1 ] && [ $(command -v update-desktop-database) ]; then
echo "trigger: Updating desktop file MIME type cache..."
update-desktop-database --quiet
fi
if [ "$trig_1" = 1 ] && [ $(type -p update-mime-database) ]; then
if [ "$trig_1" = 1 ] && [ $(command -v update-mime-database) ]; then
echo "trigger: Updating the MIME type database..."
update-mime-database /usr/share/mime
fi
@@ -1195,9 +1195,9 @@ COMPRESSION_MODE="xz"
mode=$1
if [ -z "$mode" ]; then
[ "$mode" ] || {
print_runhelp_msg
fi
}
shift
@@ -1209,7 +1209,7 @@ for opt in $@; do
-*) char=${#opt}; count=1
while [ "$count" != "$char" ]; do
count=$((count+1))
MAINOPTS="$MAINOPTS -$(echo $opt | cut -c $count)"
MAINOPTS="$MAINOPTS -$(printf '%s' $opt | cut -c $count)"
done;;
*) MAINOPTS="$MAINOPTS $opt";;
esac
@@ -1222,7 +1222,7 @@ if [ -f "$REPO_FILE" ]; then
done
fi
if [ "$(type -t scratch_$mode)" = "function" ]; then
if [ "$(command -v scratch_$mode)" ]; then
scratch_$mode $MAINOPTS
else
print_runhelp_msg

View File

@@ -20,7 +20,7 @@
EDITOR=${EDITOR:-vi}
type -p $EDITOR >/dev/null || {
command -v $EDITOR >/dev/null || {
echo "Editor '$EDITOR' not exist. Append 'EDITOR=<your editor>' to ${0##*/}."
exit 2
}