Hi Carsten (and/or Chris),

attached is a new patch with 2 fixes and some (more or less pedantic)
nitpicking.  It's based on b5fd889 in Carsten's github repo (I didn't
review every change, but it looks very good!).

You can see the single changes in the branch jre/migration20170301 at
https://github.com/jre-wine/icedove.

It contains:
* Grammar/Typo fixes
  I'd suggest asking [email protected] for
  proof-reading of the scripts and the README.

* Let find follow symlinks when searching the profile folder.

* Merge 2 sed commands.

* Avoid using -a / -o in tests as this is not well defined.
  Logically group tests with braces + semicolon instead.
  Note: Parantheses would achieve the same, but in a subshell.
  See:
  http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
    2.9.4 Compound Commands
  https://github.com/koalaman/shellcheck/wiki/SC2166

* Avoid using full pathnames when using system functions.
  cat, echo, ln and readlink are in /bin/, not in /usr/bin/.
  Previously this made thunderbird fail to start here (.thunderbird
  is a link to .icedove) with:

/usr/bin/thunderbird: 151: /usr/bin/thunderbird: /usr/bin/readlink: not
found
/usr/bin/thunderbird: 189: /usr/bin/thunderbird: /usr/bin/readlink: not
found
<12>Feb 28 17:38:33 jens[26504]: /usr/bin/thunderbird: [profile
migration] Couldn't migrate Icedove into Thunderbird profile due
existing or symlinked folder '/home/jens/.thunderbird'!
/usr/bin/thunderbird: 195: /usr/bin/thunderbird: /usr/bin/readlink: not
found
<12>Feb 28 17:38:33 jens[26506]: /usr/bin/thunderbird: [profile
migration] /home/jens/.icedove is probably a symlink pointing to a non
existing target, at least not to /home/jens/.icedove.
/usr/bin/thunderbird: 195: /usr/bin/thunderbird: /usr/bin/readlink: not
found
<12>Feb 28 17:38:33 jens[26508]: /usr/bin/thunderbird: [profile
migration] /home/jens/.thunderbird is probably a symlink pointing to a
non existing target, at least not to /home/jens/.icedove.
Gtk-Message: GtkDialog mapped without a transient parent. This is
discouraged.
/usr/bin/thunderbird: 321: /usr/bin/thunderbird: /usr/bin/echo: not found
/usr/bin/thunderbird: 321: /usr/bin/thunderbird: /usr/bin/echo: not found


Greets
jre
diff --git a/debian/thunderbird-wrapper-helper.sh b/debian/thunderbird-wrapper-helper.sh
index acc2c8e8c7..bab6e7600e 100644
--- a/debian/thunderbird-wrapper-helper.sh
+++ b/debian/thunderbird-wrapper-helper.sh
@@ -44,8 +44,8 @@ An existing profile folder (or symlink) '.thunderbird' was found in
 your Home directory '${HOME}/' while trying to migrate the Icedove
 profile(s) folder!
 
-This can probably be a old, currently not used profile folder or
-you maybe using a Thunderbird installation from the Mozilla packages.
+This could be an old, currently not used profile folder or you might
+be using a Thunderbird installation from the Mozilla packages.
 If you don't need this old profile folder, you can remove or backup
 it and start Thunderbird again.
 
@@ -106,21 +106,21 @@ TITLE="Icedove to Thunderbird Profile adoption"
 # Simple search all files where we made a backup from
 do_collect_backup_files () {
 output_debug "Collect all files we've made a backup."
-BACKUP_FILES=$(/usr/bin/find "${TB_PROFILE_FOLDER}/" -type f -name "*backup_thunderbird_migration*")
+BACKUP_FILES=$(find -L "${TB_PROFILE_FOLDER}/" -type f -name "*backup_thunderbird_migration*")
 if [ "${BACKUP_FILES}" != "" ]; then
-    output_info "The following backups related Icedove to Thunderbird transition are existing:"
-    /usr/bin/cat << EOF
+    output_info "The following backups related to the Icedove to Thunderbird transition are existing:"
+    cat << EOF
 ${BACKUP_FILES}
 EOF
 else
-    output_info "No backups related Icedove to Thunderbird transition found."
+    output_info "No backups related to the Icedove to Thunderbird transition found."
 fi
 }
 
 # Create the file .thunderbird/.migrated with some content
 do_create_migrated_mark_file (){
-/bin/cat <<EOF > "${TB_PROFILE_FOLDER}/.migrated"
-This is a automatically created file by /usr/bin/thunderbird, it will be
+cat <<EOF > "${TB_PROFILE_FOLDER}/.migrated"
+This is an automatically created file by /usr/bin/thunderbird, it will be
 recreated by every start of Thunderbird. Remove that files only if you know
 the propose of this file.
 
@@ -131,15 +131,14 @@ EOF
 
 # Fix the file $PROFILE/mimeTypes.rdf
 do_fix_mimetypes_rdf (){
-for MIME_TYPES_RDF_FILE in $(/usr/bin/find "${TB_PROFILE_FOLDER}/" -name mimeTypes.rdf); do
+for MIME_TYPES_RDF_FILE in $(find -L "${TB_PROFILE_FOLDER}/" -name mimeTypes.rdf); do
     RDF_SEARCH_PATTERN=$(grep '/usr/bin/iceweasel\|icedove' "${MIME_TYPES_RDF_FILE}")
     if [ "${RDF_SEARCH_PATTERN}" != "" ]; then
         output_debug "Backup ${MIME_TYPES_RDF_FILE} to ${MIME_TYPES_RDF_FILE}.backup_thunderbird_migration-${DATE}"
         cp "${MIME_TYPES_RDF_FILE}" "${MIME_TYPES_RDF_FILE}.backup_thunderbird_migration-${DATE}"
 
         output_debug "Fixing possible broken 'mimeTypes.rdf'."
-        sed -i "s|/usr/bin/iceweasel|/usr/bin/x-www-browser|g" "${MIME_TYPES_RDF_FILE}"
-        sed -i "s|icedove|thunderbird|g" "${MIME_TYPES_RDF_FILE}"
+        sed -i "s|/usr/bin/iceweasel|/usr/bin/x-www-browser|g;s|icedove|thunderbird|g" "${MIME_TYPES_RDF_FILE}"
     else
         output_info "No fix up for ${MIME_TYPES_RDF_FILE} needed."
     fi
@@ -183,7 +182,7 @@ do_migrate_old_icedove_desktop() {
 
 # Only jump in loop if we haven't already done a migration before or the
 # user is forcing this by the option '--fixmime'.
-if [ ! -f "${TB_PROFILE_FOLDER}/.migrated" -o "${FORCE_MIMEAPPS_MIGRATE}" = "1" ]; then
+if [ ! -f "${TB_PROFILE_FOLDER}/.migrated" ] || [ "${FORCE_MIMEAPPS_MIGRATE}" = "1" ]; then
     if [ ! -f "${TB_PROFILE_FOLDER}/.migrated" ]; then
         output_debug "No migration mark '${TB_PROFILE_FOLDER}/.migrated' found, checking mimeapps.list files for possible migration."
     elif [ "${FORCE_MIMEAPPS_MIGRATE}" = "1" ]; then
@@ -243,7 +242,7 @@ for ICEDOVE_DESKTOP in $(find "${HOME}/.local/share/applications/" -iname "*iced
 done
 }
 
-# Print out a error message about not possible adoption
+# Print out an error message about not possible adoption
 do_thunderbird2icedove_error_out (){
 case "${DESKTOP}" in
     gnome|mate|xfce)
@@ -270,7 +269,7 @@ esac
 # Symlink .thunderbird to .icedove
 do_thunderbird2icedove_symlink () {
 output_debug "Try to symlink '${TB_PROFILE_FOLDER}' to '${ID_PROFILE_FOLDER}'"
-if /usr/bin/ln -s "${ID_PROFILE_FOLDER}" "${TB_PROFILE_FOLDER}"; then
+if ln -s "${ID_PROFILE_FOLDER}" "${TB_PROFILE_FOLDER}"; then
     return 0
 else
     case "${DESKTOP}" in
@@ -329,17 +328,17 @@ fi
 
 # Simple info output function
 output_info () {
-/usr/bin/echo "INFO  -> $1"
+echo "INFO  -> $1"
 }
 
 # Simple debugging output function
 output_debug () {
 if [ "${VERBOSE}" = "1" ]; then
-    /usr/bin/echo "DEBUG -> $1"
+    echo "DEBUG -> $1"
 fi
 }
 
-# Giving out a information how this script can be called
+# Giving out an information how this script can be called
 usage () {
 cat << EOF
 
@@ -374,7 +373,7 @@ Examples:
  ${0##*/} --help
 
     Writes this help messages on stdout. If any other option is given it
-    will be ignored. Note that Thunderbird also has a option '-h' which needs
+    will be ignored. Note that Thunderbird also has an option '-h' which needs
     explictely given if want the help output for Thunderbird!
 
  ${0##*/} --verbose
diff --git a/debian/thunderbird-wrapper.sh b/debian/thunderbird-wrapper.sh
index eff9980190..10a89f7d79 100755
--- a/debian/thunderbird-wrapper.sh
+++ b/debian/thunderbird-wrapper.sh
@@ -6,7 +6,7 @@
 #
 # Purpose:
 #   This is a wrapper script for starting the thunderbird binary with taking
-#   care of the searching for a old user Icedove profile folder and adopting
+#   care of the searching for an old user Icedove profile folder and adopting
 #   the folder into the new place if possible.
 #
 # Environment:
@@ -107,7 +107,7 @@ fi
 # Thunderbird binary is finding the existing profiles in the folder         #
 # $(HOME)/.thunderbird folder or a valid symlink pointing to the profiles.  #
 #                                                                           #
-# To "migrate" a old existing Icedove profile we can simply do a symlink    #
+# To "migrate" an old existing Icedove profile we can simply do a symlink   #
 # from $(HOME)/.thunderbird --> $(HOME)/.icedove .                          #
 #                                                                           #
 # Afterwards do some changes to the file mimeTypes.rdf within every         #
@@ -121,8 +121,8 @@ fi
 
 # First try the default case for modification, there is only a folder
 # ${ID_PROFILE_FOLDER} and we can symlink to this.
-if [ -d "${ID_PROFILE_FOLDER}" -o -L "${ID_PROFILE_FOLDER}" ] && \
-   [ ! -d "${TB_PROFILE_FOLDER}" -a ! -L "${TB_PROFILE_FOLDER}" ]; then
+if { [ -d "${ID_PROFILE_FOLDER}" ] || [ -L "${ID_PROFILE_FOLDER}" ]; } && \
+   { [ ! -d "${TB_PROFILE_FOLDER}" ] && [ ! -L "${TB_PROFILE_FOLDER}" ]; }; then
     output_debug "found folder '${ID_PROFILE_FOLDER}'"
     output_debug "not found folder or symlink '${TB_PROFILE_FOLDER}'"
     output_debug "Start Thunderbird profile adoptions, please be patient!"
@@ -147,8 +147,8 @@ fi
 
 # We found both profile folder, and .thunderbird is a symlink,
 # we need to check if .thunderbird is symlinked to .icedove
-if [ -d "${ID_PROFILE_FOLDER}" -a -L "${TB_PROFILE_FOLDER}" ] && \
-   [ "$(/usr/bin/readlink -e "${TB_PROFILE_FOLDER}")" = "${ID_PROFILE_FOLDER}" ];then
+if { [ -d "${ID_PROFILE_FOLDER}" ] && [ -L "${TB_PROFILE_FOLDER}" ]; } && \
+   [ "$(readlink -e "${TB_PROFILE_FOLDER}")" = "${ID_PROFILE_FOLDER}" ];then
 
     output_debug "Found folder ${ID_PROFILE_FOLDER}, found a symlink ${TB_PROFILE_FOLDER} pointing to ${ID_PROFILE_FOLDER}"
 
@@ -164,8 +164,8 @@ if [ -d "${ID_PROFILE_FOLDER}" -a -L "${TB_PROFILE_FOLDER}" ] && \
     fi
 
 # ... or the opposite if .icedove is symlinked to .thunderbird
-elif [ -d "${TB_PROFILE_FOLDER}" -a -L "${ID_PROFILE_FOLDER}" ] && \
-     [ "$(/usr/bin/readlink -e "${ID_PROFILE_FOLDER}")" != "${TB_PROFILE_FOLDER}" ];then
+elif { [ -d "${TB_PROFILE_FOLDER}" ] && [ -L "${ID_PROFILE_FOLDER}" ]; } && \
+     [ "$(readlink -e "${ID_PROFILE_FOLDER}")" != "${TB_PROFILE_FOLDER}" ];then
 
     output_debug "Found folder ${TB_PROFILE_FOLDER}, found a symlink ${ID_PROFILE_FOLDER} pointing to ${TB_PROFILE_FOLDER}"
     output_debug "You may want to remove the symlink ${ID_PROFILE_FOLDER}? It's probably not needed anymore."
@@ -182,17 +182,17 @@ elif [ -d "${TB_PROFILE_FOLDER}" -a -L "${ID_PROFILE_FOLDER}" ] && \
 
 # We found both profile folder, but they are not linked to each other! This
 # is a state we can't solve on our own !!! The user needs to interact and
-# has probably a old or otherwise used Thunderbird installation. Which one
+# has probably an old or otherwise used Thunderbird installation. Which one
 # is the correct one to use?
-elif [ -d "${ID_PROFILE_FOLDER}" -o -L "${ID_PROFILE_FOLDER}" ] && \
-     [ -d "${TB_PROFILE_FOLDER}" -o -L "${TB_PROFILE_FOLDER}" ] && \
-     [ "$(/usr/bin/readlink -e "${TB_PROFILE_FOLDER}")" != "${ID_PROFILE_FOLDER}" ]; then
+elif { [ -d "${ID_PROFILE_FOLDER}" ] || [ -L "${ID_PROFILE_FOLDER}" ]; } && \
+     { [ -d "${TB_PROFILE_FOLDER}" ] || [ -L "${TB_PROFILE_FOLDER}" ]; } && \
+     [ "$(readlink -e "${TB_PROFILE_FOLDER}")" != "${ID_PROFILE_FOLDER}" ]; then
 
     output_debug "There is already a folder or symlink '${TB_PROFILE_FOLDER}', will do nothing."
     output_debug "Please investigate by yourself! Some more information below."
     logger -i -p warning -s "$0: [profile migration] Couldn't migrate Icedove into Thunderbird profile due existing or symlinked folder '${TB_PROFILE_FOLDER}'!"
     for CHECK in ${ID_PROFILE_FOLDER} ${TB_PROFILE_FOLDER}; do
-        FILE_CHECK=$(/usr/bin/readlink -e "${CHECK}")
+        FILE_CHECK=$(readlink -e "${CHECK}")
         if [ "${FILE_CHECK}" != "" ] && [ -L "${CHECK}" ]; then
             output_debug "Found symlink '${FILE_CHECK}'"
         elif [ "${FILE_CHECK}" != "" ] && [ -d "${CHECK}" ]; then
@@ -209,7 +209,7 @@ elif [ -d "${ID_PROFILE_FOLDER}" -o -L "${ID_PROFILE_FOLDER}" ] && \
 fi
 
 if [ "$FAIL" = 1 ]; then
-    output_info "A error happened while trying to migrate the old Icedove profile folder '${ID_PROFILE_FOLDER}'."
+    output_info "An error happened while trying to migrate the old Icedove profile folder '${ID_PROFILE_FOLDER}'."
     output_info "Please take a look into the syslog file!"
     exit 1
 fi

Reply via email to