Package: weechat-matrix
Severity: normal

Hi,

The command 'weechat-matrix-wrapper enable' sets symbolic links as
expected, but the corresponding

    weechat-matrix-wrapper disable

does not remove them. IInstead, it produces this error message:

$ weechat-matrix-wrapper disable
Disabling Weechat-matrix
Weechat-matrix installed into /home/lechner/.weechat/python/matrix,
unable to continue

Upon inspection, the issue seems to relate to those lines in the wrapper:

    if [ -d $DESTINATION/matrix ]; then
        echo "Weechat-matrix installed into $DESTINATION/matrix,
unable to continue"
        exit 1
    fi

For the linked directory created by 'enable' the removal should
proceed, but the condition returns true and aborts.

Below is a patch that checks instead that both paths are links (which
is what 'enable' installed). The patch was tested locally. Thank you!

Kind regards
Felix Lechner

* * *

--- weechat-matrix-wrapper      2021-08-09 06:13:05.820766987 -0700
+++ /usr/bin/weechat-matrix-wrapper     2021-08-09 06:35:44.739926938 -0700
@@ -20,24 +20,26 @@
 if [ "$ACTION" = "enable" ]; then
     echo "Enabling Weechat-matrix"
     if [ -L $DESTINATION/matrix ]; then
-        echo "Weechat-matrix already enabled"
+        echo "Weechat-matrix was already enabled"
         exit 0
     fi
     if [ -d $DESTINATION/matrix ]; then
-        echo "Weechat-matrix installed into $DESTINATION/matrix,
unable to continue"
+        echo "$DESTINATION/matrix exists, unable to continue"
         exit 1
     fi
     ln -s $SOURCE/matrix $DESTINATION/matrix
     ln -s $SOURCE/matrix.py $DESTINATION/autoload/matrix.py
 elif [ "$ACTION" = "disable" ]; then
     echo "Disabling Weechat-matrix"
-    if [ -d $DESTINATION/matrix ]; then
-        echo "Weechat-matrix installed into $DESTINATION/matrix,
unable to continue"
+    if [ ! -L $DESTINATION/matrix ]; then
+        echo "$DESTINATION/matrix is not a link, unable to continue"
         exit 1
     fi
-    if [ -L $DESTINATION/matrix ]; then
-        rm $DESTINATION/matrix $DESTINATION/autoload/matrix.py
+    if [ ! -L $DESTINATION/autoload/matrix.py ]; then
+        echo "$DESTINATION/autoload/matrix.py is not a link, unable
to continue"
+        exit 1
     fi
+    rm -f $DESTINATION/matrix $DESTINATION/autoload/matrix.py
 else
     showhelp
 fi

Reply via email to