summaryrefslogtreecommitdiff
path: root/debian/patches/install_dir
blob: 57b676d7caf332a7eb8a61ae29cf7387b2be6184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Author: Tzafrir Cohen <tzafrir@debian.org>
Description: These things are easier to install with dh

* Python modules: fighting with dh_python2 is tough
  (it changes the /etc/ symlink, for isntance)
* Let's just install man pages ourselves for now.
* symlinks: with dh_link

--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,8 @@ PWD=`pwd`
 SLEEP_TIME=300
 EXCLUDE=--exclude=*.tar.gz --exclude=*~ $(EXCLUDE-FILES)
 ALL_BUT_GZ=$(subst $(wildcard *.tar.gz),,$(wildcard *))
+DATADIR=/usr/share/plinth
+PYDIR=$(DATADIR)/python/plinth
 
 ## Catch-all tagets
 default: config dirs template css docs dbs
@@ -23,21 +25,12 @@ predepend:
 install: default
 	mkdir -p $(DESTDIR)/etc/init.d $(DESTDIR)/etc/plinth
 	cp plinth.sample.fhs.config $(DESTDIR)/etc/plinth/plinth.config
-	mkdir -p $(DESTDIR)/usr/lib/python2.7/plinth $(DESTDIR)/usr/bin \
+	mkdir -p $(DESTDIR)$(PYDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)/usr/bin \
 		$(DESTDIR)/usr/share/doc/plinth $(DESTDIR)/usr/share/man/man1
-	rsync -L doc/* $(DESTDIR)/usr/share/doc/plinth/
-	gzip $(DESTDIR)/usr/share/doc/plinth/plinth.1 
-	mv $(DESTDIR)/usr/share/doc/plinth/plinth.1.gz $(DESTDIR)/usr/share/man/man1
-	rsync -rl *.py modules templates vendor themes static \
-		--exclude static/doc --exclude ".git/*" --exclude "*.pyc" \
-		$(DESTDIR)/usr/lib/python2.7/plinth
-	mkdir -p $(DESTDIR)/usr/lib/python2.7/plinth/static/doc
-	cp doc/*.html $(DESTDIR)/usr/lib/python2.7/plinth/static/doc
-	rm -f $(DESTDIR)/usr/lib/python2.7/plinth/plinth.config
-	ln -s ../../../../etc/plinth/plinth.config $(DESTDIR)/usr/lib/python2.7/plinth/plinth.config
+	cp -a static themes $(DESTDIR)$(DATADIR)/
+	cp -a *.py modules templates $(DESTDIR)$(PYDIR)/
 	cp share/init.d/plinth $(DESTDIR)/etc/init.d
-	rm -f $(DESTDIR)/usr/bin/plinth
-	ln -s ../lib/python2.7/plinth/plinth.py $(DESTDIR)/usr/bin/plinth
+	install plinth $(DESTDIR)/usr/bin/
 	mkdir -p $(DESTDIR)/var/lib/plinth/cherrypy_sessions $(DESTDIR)/var/log/plinth $(DESTDIR)/var/run
 	cp -r data/* $(DESTDIR)/var/lib/plinth
 	rm -f $(DESTDIR)/var/lib/plinth/users/sqlite3.distrib
--- a/plinth.sample.fhs.config
+++ b/plinth.sample.fhs.config
@@ -3,7 +3,8 @@ product_name = Plinth
 box_name = FreedomBox
 
 [Path]
-file_root = /usr/lib/python2.7/plinth
+file_root = /usr/share/plinth/static
+python_root = /usr/share/plinth/python/plinth
 data_dir = /var/lib/plinth
 store_file = %(data_dir)s/store.sqlite3
 user_db = %(data_dir)s/users
--- /dev/null
+++ b/plinth
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+export PYTHONPATH=/usr/share/plinth/python
+exec python /usr/share/plinth/python/plinth/plinth.py "$@"
--- a/cfg.py
+++ b/cfg.py
@@ -8,6 +8,7 @@ parser = SafeConfigParser(
         'product_name':"",
         'box_name':"",
         'file_root':"",
+        'python_root':"",
         'data_dir':"",
         'store_file':"",
         'user_db':"",
@@ -24,6 +25,7 @@ product_name = parser.get('Name', 'produ
 box_name = parser.get('Name', 'box_name')
 root = parser.get('Path', 'root')
 file_root = parser.get('Path', 'file_root')
+python_root = parser.get('Path', 'python_root')
 data_dir = parser.get('Path', 'data_dir')
 store_file = parser.get('Path', 'store_file')
 user_db = parser.get('Path', 'user_db')
--- a/plinth.py
+++ b/plinth.py
@@ -125,7 +125,7 @@ def setup():
          cfg.exmachina = None
          print "couldn't connect to exmachina daemon, but continuing anyways..."
 
-   os.chdir(cfg.file_root)
+   os.chdir(cfg.python_root)
    cherrypy.config.update({'error_page.404': error_page_404})
    cherrypy.config.update({'error_page.500': error_page_500})
    cfg.log = Logger()