summarylogtreecommitdiffstats
path: root/migrationhelper
blob: 1965368bfd4775dd09bb315e50c052a059fd1d73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#shellcheck disable=SC1001

printf '\n\n  \033[1;33mmailwizard\n  ¯¯¯¯¯¯¯¯¯¯\033[31m\n'
echo 'Please execute this only if you are migrating from mutt-wizard to mailwizard.'
printf '\n\033[0;32mDo you have an active mutt-wizard configuration [y/N] ?  \033[1;34m'
read -r
case x$REPLY in
	x[yY])
		printf '\n\n\033[0;33m'
		cat <<-E1
			The configuration files need to be patched to prevent conflicts with mailwizard.
			You could either  do this  manually by following a  four-step guide  you will be
			shown if you should decide to do so.
			Otherwise this script can automatically do the necessary steps for you.
		E1
		printf '\n\033[32mDo you want your config migrated automatically [y/N] ?  \033[1;34m'
		read -r
		case x$REPLY in
			x[yY])
				printf '\n\n\033[0m'
				echo \$ mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/isync"
				#mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/isync"
				echo \$ mv ~/.mbsyncrc "${XDG_CONFIG_HOME:-$HOME/.config}/isync/mbsyncrc"
				#mv ~/.mbsyncrc "${XDG_CONFIG_HOME:-$HOME/.config}/isync/mbsyncrc"
				echo \$ sed -i~ \'s/mutt-\(wizard\)/mail\1/g\' \
					"${XDG_CONFIG_HOME:-$HOME/.config}/isync/mbsyncrc" \
					"$HOME/.config/msmtp/msmtprc"
				#sed -i~ 's/mutt-\(wizard\)/mail\1/g' \
					#"${XDG_CONFIG_HOME:-$HOME/.config}/isync/mbsyncrc" \
					#"$HOME/.config/msmtp/msmtprc"
				echo \$ sed -i~ \'/\# mw-autogenerated/d\' "${XDG_CONFIG_HOME:-$HOME/.config}/muttrc"
				#sed -i~ '/\# mw-autogenerated/d' "${XDG_CONFIG_HOME:-$HOME/.config}/muttrc"
				echo \$ rm -r "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts"
				#rm -r "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/accounts"
				;;
			x*)
				printf '\n\n\n\033[1;31m  Migration Guide\n  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\033[0;36m'
				cat <<-E2
					• Edit "~/.mbsyncrc", change 'mutt-wizard' to 'mailwizard', and move this file
					  to "~/.config/isync/mbsyncrc".

					• Edit "~/.config/msmtp/msmtprc" and change 'mutt-wizard' to 'mailwizard' here
					  too.  Leave this file at its place.

					• Edit "~/.config/mutt/muttrc" in-place, remove all lines which were generated
					  by mutt-wizard.

					• Remove all files inside "~/.config/mutt/accounts/". These shall be regenera-
					  ted 'the mailwizard way' the next time you run the "mw" command.
				E2
		esac
esac
printf '\033[0m\n'

# vim: ts=2 sw=2 noet ft=bash: