f87ff24
From 0e67f1ec9cd61a7cbf03bedf79083bce7c227b8e Mon Sep 17 00:00:00 2001
85341ef
From: Tomas Tomecek <ttomecek@redhat.com>
f87ff24
Date: Fri, 24 Jun 2016 11:38:32 +0200
5181416
Subject: [PATCH] install-py: add distribution argument
85341ef
85341ef
---
5181416
 install.py | 15 +++++++++++++--
5181416
 1 file changed, 13 insertions(+), 2 deletions(-)
85341ef
85341ef
diff --git a/install.py b/install.py
f87ff24
index b48dbe4..a7307c4 100755
85341ef
--- a/install.py
85341ef
+++ b/install.py
999bf72
@@ -104,6 +104,10 @@ def parse_arguments():  # noqa
f87ff24
         '-s', '--system', action='store_true', default=False,
999bf72
         help='install system wide for all users',
999bf72
     )
85341ef
+    parser.add_argument(
85341ef
+        '--distribution', action="store_true", default=False,
999bf72
+        help='enable installation to a distribution'
999bf72
+    )
85341ef
 
85341ef
     args = parser.parse_args()
85341ef
 
999bf72
@@ -187,8 +191,10 @@ def main(args):
f87ff24
         print('Installing autojump to %s ...' % args.destdir)
85341ef
 
85341ef
     bin_dir = os.path.join(args.destdir, args.prefix, 'bin')
5181416
+    root_etc_dir = os.path.join('/', 'etc', 'profile.d')
5181416
     etc_dir = os.path.join(args.destdir, 'etc', 'profile.d')
85341ef
     doc_dir = os.path.join(args.destdir, args.prefix, 'share', 'man', 'man1')
5181416
+    root_share_dir = os.path.join('/', args.prefix, 'share', 'autojump')
5181416
     share_dir = os.path.join(args.destdir, args.prefix, 'share', 'autojump')
85341ef
     zshshare_dir = os.path.join(args.destdir, args.zshshare)
85341ef
 
999bf72
@@ -227,9 +233,15 @@ def main(args):
85341ef
         cp('./bin/_j', zshshare_dir, args.dryrun)
85341ef
 
85341ef
         if args.custom_install:
85341ef
-            modify_autojump_sh(etc_dir, share_dir, args.dryrun)
85341ef
+            if args.distribution:
5181416
+                modify_autojump_sh(etc_dir, root_share_dir, args.dryrun)
85341ef
+            else:
85341ef
+                modify_autojump_sh(etc_dir, share_dir, args.dryrun)
85341ef
 
5181416
-    show_post_installation_message(etc_dir, share_dir, bin_dir)
5181416
+    if args.distribution:
5181416
+        show_post_installation_message(root_etc_dir, root_share_dir, bin_dir)
5181416
+    else:
5181416
+        show_post_installation_message(etc_dir, share_dir, bin_dir)
85341ef
 
5181416
 
f87ff24
 if __name__ == '__main__':
85341ef
-- 
f87ff24
2.9.0