upgrade/2.bash
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 16 Jun 2021 12:50:08 +0300
changeset 1734 ae2c6a001464
parent 1666 06937ff1ec5f
permissions -rw-r--r--
Add some standard places to PATH if they are not set by login script. Rearrange the order of paths so system's are first, user's are last. For Cygwin this helps with Cygwin's paths to be situated before "C:/Windows" (Emacs is not started from a login shell on Windows!).

#!/bin/bash

set -x -e

emacsdir=~/.emacs.d
compatfile=$emacsdir/.emacs-ver
mylispdir_old=$emacsdir/my
mylispdir_new=$emacsdir/mylisp

if ! [[ -f $compatfile ]]; then
    echo 'Cannot detect compatibility.'
    exit 1
fi
read ver <$compatfile
if [[ $ver != 1 ]]; then
  echo 'Script is designed only for upgrade: v1 => v2.'
  exit 1
fi

rm $mylispdir_old/init.el || :
mv $mylispdir_old $mylispdir_new || :
rm $emacsdir/.emacs-my.elc || :

echo 2 >$compatfile