* `share/trashman/<package>/<ancestor>/<family>/<action>`: script that runs on a given action, fallback.
* `share/trashman/<package>/<ancestor>/<action>`: script that runs on a given action, fallback.
-Where actions can be like `install`, `test`, `remove` or `upgrade`. You don't have
+Where actions can be like `install`, `check`, `remove` or `upgrade`. You don't have
to implement all actions. Actually, no action is required to create a package, but
having no action makes it useless.
-### Test action
+### Check action
-The test action may return the following exit codes:
+The `check` action may return the following exit codes:
* 0: the package is installed system-wide.
* 1: the package is not installed system-wide.
TODO
====
+* Multi-licensing and note on the lack of licensing for some scripts.
* Support more OSes at `__trashman_distro()`.
* Argument passing to distro/action scripts as `--param=value`.
* Packages:
fi
}
+# Distro release version
+__trashman_distro_release() {
+ if [ -e "/etc/os-release" ]; then
+ grep "^VERSION=" /etc/os-release | cut -d '(' -f 2 | cut -d ')' -f 1
+ fi
+}
+
# Return the folder where actions are available for a package
__trashman_actions_folder() {
local package="$1"
$GIT submodule update --init --recursive
)
}
+
+__trashman_install_apt_key() {
+ local orig="$1"
+ local dest="$2"
+
+ if [ ! -e "$orig" ]; then
+ exit 1
+ fi
+
+ cp $orig /etc/apt/trusted.gpg.d/$dest || exit 1
+ chown root.root /etc/apt/trusted.gpg.d/$dest && chmod 644 /etc/apt/trusted.gpg.d/$dest || exit 1
+}
--- /dev/null
+#!/usr/bin/env sh
+#
+# Test if trashman is installed system-wide.
+#
+
+# Parameters
+SHARE="$1"
+BASE="$SHARE/../.."
+FOLDER="/usr/local"
+
+# Include basic functions
+. $SHARE/trashman/functions || exit 1
+
+# Check if it is installed
+if [ -x "$FOLDER/bin/trashman" ] && [ -x "$FOLDER/share/trashman/trashman" ]; then
+ exit 0
+fi
+
+# Check if it is not installed
+if [ ! -x "$FOLDER/bin/trashman" ] && [ ! -x "$FOLDER/share/trashman/trashman" ]; then
+ exit 1
+fi
+
+# It is partially installed
+exit 2
#!/usr/bin/env sh
#
-# Test if trashman is installed system-wide.
+# Test suite for trashman.
#
# Parameters
# Include basic functions
. $SHARE/trashman/functions || exit 1
-# Check if it is installed
-if [ -x "$FOLDER/bin/trashman" ] && [ -x "$FOLDER/share/trashman/trashman" ]; then
+# Run test suite
+if trashman | grep -q "^trashman:"; then
+ __trashman_echo "trashman seems to be working"
exit 0
-fi
-
-# Check if it is not installed
-if [ ! -x "$FOLDER/bin/trashman" ] && [ ! -x "$FOLDER/share/trashman/trashman" ]; then
+else
+ __trashman_echo "trashman not working correctly"
exit 1
fi
-
-# It is partially installed
-exit 2
folder="`__trashman_actions_folder $package`"
if [ -x "$SHARE/$package/$folder/$ACTION" ]; then
- if [ "$ACTION" != "test" ]; then
+ if [ "$ACTION" != "check" ] && [ "$ACTION" != "test" ]; then
__trashman_echo "Dumpsterizing your system: action $ACTION for $package ($folder)..."
fi
$SHARE/$package/$folder/$ACTION $SHARE
status="$?"
- if [ "$ACTION" = "test" ]; then
+ if [ "$ACTION" = "check" ]; then
if [ "$status" = "0" ]; then
__trashman_echo "Package trashman is installed system-wide"
elif [ "$status" = "1" ]; then