1
0
mirror of https://github.com/wting/autojump synced 2024-09-28 14:00:46 +00:00

Install to /usr/local/share, not /etc/profile.d.

Stops all the scripts being loaded by all the shells.
Fix joelthelion/autojump#267.
This commit is contained in:
Felix Laurie von Massenbach 2014-06-26 01:23:25 +01:00
parent fbf932c4f2
commit 9dd1e0411c
2 changed files with 42 additions and 44 deletions

View File

@ -7,11 +7,11 @@ if [ "${shell}" = "sh" ]; then
return 0
# check local install
elif [ -s ~/.autojump/etc/profile.d/autojump.${shell} ]; then
source ~/.autojump/etc/profile.d/autojump.${shell}
elif [ -s ~/.autojump/usr/local/share/autojump/autojump.${shell} ]; then
source ~/.autojump/usr/local/share/autojump/autojump.${shell}
# check global install
elif [ -s /etc/profile.d/autojump.${shell} ]; then
source /etc/profile.d/autojump.${shell}
elif [ -s /usr/local/share/autojump/autojump.${shell} ]; then
source /usr/local/share/autojump/autojump.${shell}
fi

View File

@ -29,15 +29,15 @@ def mkdir(path, dryrun=False):
os.makedirs(path)
def modify_autojump_sh(etc_dir, dryrun=False):
def modify_autojump_sh(share_dir, dryrun=False):
"""Append custom installation path to autojump.sh"""
custom_install = "\
\n# check custom install \
\nif [ -s %s/autojump.${shell} ]; then \
\n\tsource %s/autojump.${shell} \
\nfi\n" % (etc_dir, etc_dir)
\nfi\n" % (share_dir, share_dir)
with open(os.path.join(etc_dir, 'autojump.sh'), 'a') as f:
with open(os.path.join(share_dir, 'autojump.sh'), 'a') as f:
f.write(custom_install)
@ -136,16 +136,16 @@ def parse_arguments(): # noqa
return args
def print_post_installation_message(etc_dir, bin_dir):
def print_post_installation_message(share_dir, bin_dir):
if platform.system() == 'Windows':
print("\nPlease manually add %s to your user path" % bin_dir)
else:
if get_shell() == 'fish':
aj_shell = '%s/autojump.fish' % etc_dir
aj_shell = '%s/autojump.fish' % share_dir
source_msg = "if test -f %s; . %s; end" % (aj_shell, aj_shell)
rcfile = '~/.config/fish/config.fish'
else:
aj_shell = '%s/autojump.sh' % etc_dir
aj_shell = '%s/autojump.sh' % share_dir
source_msg = "[[ -s %s ]] && source %s" % (aj_shell, aj_shell)
if platform.system() == 'Darwin' and get_shell() == 'bash':
@ -167,20 +167,19 @@ def main(args):
print("Installing autojump to %s ..." % args.destdir)
bin_dir = os.path.join(args.destdir, args.prefix, 'bin')
etc_dir = os.path.join(args.destdir, 'etc', 'profile.d')
doc_dir = os.path.join(args.destdir, args.prefix, 'share', 'man', 'man1')
icon_dir = os.path.join(args.destdir, args.prefix, 'share', 'autojump')
share_dir = os.path.join(args.destdir, args.prefix, 'share', 'autojump')
zshshare_dir = os.path.join(args.destdir, args.zshshare)
mkdir(bin_dir, args.dryrun)
mkdir(doc_dir, args.dryrun)
mkdir(icon_dir, args.dryrun)
mkdir(share_dir, args.dryrun)
cp('./bin/autojump', bin_dir, args.dryrun)
cp('./bin/autojump_argparse.py', bin_dir, args.dryrun)
cp('./bin/autojump_data.py', bin_dir, args.dryrun)
cp('./bin/autojump_utils.py', bin_dir, args.dryrun)
cp('./bin/icon.png', icon_dir, args.dryrun)
cp('./bin/icon.png', share_dir, args.dryrun)
cp('./docs/autojump.1', doc_dir, args.dryrun)
if platform.system() == 'Windows':
@ -194,20 +193,19 @@ def main(args):
if args.custom_install:
modify_autojump_lua(args.clinkdir, bin_dir, args.dryrun)
else:
mkdir(etc_dir, args.dryrun)
mkdir(share_dir, args.dryrun)
mkdir(zshshare_dir, args.dryrun)
cp('./bin/autojump.sh', etc_dir, args.dryrun)
cp('./bin/autojump.bash', etc_dir, args.dryrun)
cp('./bin/autojump.fish', etc_dir, args.dryrun)
cp('./bin/autojump.zsh', etc_dir, args.dryrun)
cp('./bin/autojump.sh', share_dir, args.dryrun)
cp('./bin/autojump.bash', share_dir, args.dryrun)
cp('./bin/autojump.fish', share_dir, args.dryrun)
cp('./bin/autojump.zsh', share_dir, args.dryrun)
cp('./bin/_j', zshshare_dir, args.dryrun)
if args.custom_install:
modify_autojump_sh(etc_dir, args.dryrun)
modify_autojump_sh(share_dir, args.dryrun)
print_post_installation_message(etc_dir, bin_dir)
print_post_installation_message(share_dir, bin_dir)
if __name__ == "__main__":