diff --git a/debian/changelog b/debian/changelog index ff26d350..39b6bbab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -byobu (3.8) unreleased; urgency=low +byobu (3.8-0ubuntu1) natty; urgency=low - * UNRELEASED + * usr/bin/byobu-janitor: fix migration to XDG, LP: #673797, #673727 - -- Dustin Kirkland Mon, 08 Nov 2010 18:24:15 -0600 + -- Dustin Kirkland Wed, 10 Nov 2010 18:29:01 -0600 byobu (3.7-0ubuntu1) natty; urgency=low diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index 600610d4..6ed18a10 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -26,8 +26,23 @@ PKG="byobu" RUN="$SOCKETDIR/S-$USER" FLAG="$RUN/$PKG.reload-required" -# Never hurts, always helps to do this -[ -d "$DATA" ] || mkdir -p "$DATA" +# Handle xdg migration +if [ -d "$HOME/.$PKG" ]; then + # Old dir exists + if [ ! -e "$DATA" ]; then + # New dir does not; rename and link back + mkdir -p $(dirname "$DATA") + mv -f "$HOME/.$PKG" "$DATA" + ln -sf "$DATA" "$HOME/.$PKG" + elif [ -d "$DATA" ]; then + # Old and new dir exist; migrate files from old to new + mv -f "$HOME/.$PKG/"* "$DATA" 2>/dev/null + rmdir "$HOME/.$PKG" + ln -sf "$DATA" "$HOME/.$PKG" + fi +fi +# Make the directory just in case +mkdir -p "$DATA" # Exit immediately, if we're not forced, and there is no reload flag if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then @@ -40,12 +55,6 @@ PROFILE="$DATA/profile" # Use gsed on non-Linux OS's which gsed 2>/dev/null && SED="gsed" || SED="sed" -# If the old dir exists, but the xdg one doesn't, migrate -if [ -d "$HOME/.$PKG" ] && [ ! -e "$DATA" ]; then - mv -f "$HOME/.$PKG" "$DATA" - ln -sf "$DATA" "$HOME/.$PKG" -fi - # Create byobu-exchange buffer file, with secure permissions, if it doesn't exist if [ -w "$RUN" ] && [ ! -e "$RUN/$PKG-exchange" ]; then install -m 600 /dev/null "$RUN/$PKG-exchange"