mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +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:
parent
fbf932c4f2
commit
9dd1e0411c
@ -7,11 +7,11 @@ if [ "${shell}" = "sh" ]; then
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
# check local install
|
# check local install
|
||||||
elif [ -s ~/.autojump/etc/profile.d/autojump.${shell} ]; then
|
elif [ -s ~/.autojump/usr/local/share/autojump/autojump.${shell} ]; then
|
||||||
source ~/.autojump/etc/profile.d/autojump.${shell}
|
source ~/.autojump/usr/local/share/autojump/autojump.${shell}
|
||||||
|
|
||||||
# check global install
|
# check global install
|
||||||
elif [ -s /etc/profile.d/autojump.${shell} ]; then
|
elif [ -s /usr/local/share/autojump/autojump.${shell} ]; then
|
||||||
source /etc/profile.d/autojump.${shell}
|
source /usr/local/share/autojump/autojump.${shell}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
34
install.py
34
install.py
@ -29,15 +29,15 @@ def mkdir(path, dryrun=False):
|
|||||||
os.makedirs(path)
|
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"""
|
"""Append custom installation path to autojump.sh"""
|
||||||
custom_install = "\
|
custom_install = "\
|
||||||
\n# check custom install \
|
\n# check custom install \
|
||||||
\nif [ -s %s/autojump.${shell} ]; then \
|
\nif [ -s %s/autojump.${shell} ]; then \
|
||||||
\n\tsource %s/autojump.${shell} \
|
\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)
|
f.write(custom_install)
|
||||||
|
|
||||||
|
|
||||||
@ -136,16 +136,16 @@ def parse_arguments(): # noqa
|
|||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
def print_post_installation_message(etc_dir, bin_dir):
|
def print_post_installation_message(share_dir, bin_dir):
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
print("\nPlease manually add %s to your user path" % bin_dir)
|
print("\nPlease manually add %s to your user path" % bin_dir)
|
||||||
else:
|
else:
|
||||||
if get_shell() == 'fish':
|
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)
|
source_msg = "if test -f %s; . %s; end" % (aj_shell, aj_shell)
|
||||||
rcfile = '~/.config/fish/config.fish'
|
rcfile = '~/.config/fish/config.fish'
|
||||||
else:
|
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)
|
source_msg = "[[ -s %s ]] && source %s" % (aj_shell, aj_shell)
|
||||||
|
|
||||||
if platform.system() == 'Darwin' and get_shell() == 'bash':
|
if platform.system() == 'Darwin' and get_shell() == 'bash':
|
||||||
@ -167,20 +167,19 @@ def main(args):
|
|||||||
print("Installing autojump to %s ..." % args.destdir)
|
print("Installing autojump to %s ..." % args.destdir)
|
||||||
|
|
||||||
bin_dir = os.path.join(args.destdir, args.prefix, 'bin')
|
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')
|
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)
|
zshshare_dir = os.path.join(args.destdir, args.zshshare)
|
||||||
|
|
||||||
mkdir(bin_dir, args.dryrun)
|
mkdir(bin_dir, args.dryrun)
|
||||||
mkdir(doc_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', bin_dir, args.dryrun)
|
||||||
cp('./bin/autojump_argparse.py', 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_data.py', bin_dir, args.dryrun)
|
||||||
cp('./bin/autojump_utils.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)
|
cp('./docs/autojump.1', doc_dir, args.dryrun)
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
@ -194,20 +193,19 @@ def main(args):
|
|||||||
if args.custom_install:
|
if args.custom_install:
|
||||||
modify_autojump_lua(args.clinkdir, bin_dir, args.dryrun)
|
modify_autojump_lua(args.clinkdir, bin_dir, args.dryrun)
|
||||||
else:
|
else:
|
||||||
mkdir(etc_dir, args.dryrun)
|
mkdir(share_dir, args.dryrun)
|
||||||
mkdir(zshshare_dir, args.dryrun)
|
mkdir(zshshare_dir, args.dryrun)
|
||||||
|
|
||||||
cp('./bin/autojump.sh', etc_dir, args.dryrun)
|
cp('./bin/autojump.sh', share_dir, args.dryrun)
|
||||||
cp('./bin/autojump.bash', etc_dir, args.dryrun)
|
cp('./bin/autojump.bash', share_dir, args.dryrun)
|
||||||
cp('./bin/autojump.fish', etc_dir, args.dryrun)
|
cp('./bin/autojump.fish', share_dir, args.dryrun)
|
||||||
cp('./bin/autojump.zsh', etc_dir, args.dryrun)
|
cp('./bin/autojump.zsh', share_dir, args.dryrun)
|
||||||
cp('./bin/_j', zshshare_dir, args.dryrun)
|
cp('./bin/_j', zshshare_dir, args.dryrun)
|
||||||
|
|
||||||
if args.custom_install:
|
if args.custom_install:
|
||||||
modify_autojump_sh(etc_dir, args.dryrun)
|
modify_autojump_sh(share_dir, args.dryrun)
|
||||||
|
|
||||||
|
print_post_installation_message(share_dir, bin_dir)
|
||||||
print_post_installation_message(etc_dir, bin_dir)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user