diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-23 15:58:46 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-01-23 15:58:46 +0900 |
| commit | 233394bd9a179623be96ac0ee49f9f018b3e378b (patch) | |
| tree | 48ea79455b0696048731d0da8b2c877c07b7ffd0 | |
| parent | dc59b155d8ebe9d63994cffae824a2f57cb6516f (diff) | |
modified Makefile, modified bin/mw
| -rw-r--r-- | Makefile | 30 | ||||
| -rwxr-xr-x | bin/mw | 11 |
2 files changed, 39 insertions, 2 deletions
@@ -2,7 +2,8 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man -DEPENDENCIES = neomutt curl isync msmtp pass ca-certificates gettext +DEPENDENCIES = neomutt curl msmtp pass gettext +NON_EXEC_DEPS = isync ca-certificates check-dependencies: @for dep in $(DEPENDENCIES); do \ @@ -11,6 +12,33 @@ check-dependencies: exit 1; \ fi; \ done + @for dep in $(NON_EXEC_DEPS); do \ + if command -v pacman >/dev/null 2>&1; then \ + if ! pacman -Q $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + elif command -v dpkg >/dev/null 2>&1; then \ + if ! dpkg -s $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + elif command -v rpm >/dev/null 2>&1; then \ + if ! rpm -q $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + elif command -v zypper >/dev/null 2>&1; then \ + if ! zypper se -i $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + else \ + echo "Error: Unsupported package manager. Cannot verify installation of $$dep."; \ + exit 1; \ + fi; \ + done + @echo "All dependencies are installed." install-dependencies: @if command -v apt-get >/dev/null 2>&1; then \ @@ -219,7 +219,16 @@ getboxes() { else info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && errorexit - mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" + unsorted_mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" + desired_order="Archive INBOX Drafts Sent Junk Trash" + mailboxes="" + for desired in $desired_order; do + if echo "$unsorted_mailboxes" | grep -qx "$desired"; then + mailboxes="${mailboxes}${desired} +" + fi + done + mailboxes="$(printf "%s" "$mailboxes" | sed '/^$/d')" fi [ "$type" = "pop" ] && mailboxes="INBOX" for x in $( |
