mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Use affero, not gplv3. Thanks to Mathieu Jourdan
This commit is contained in:
parent
9da6618e37
commit
88a8dee485
143
COPYING
143
COPYING
@ -20,10 +20,10 @@ In default form, Plinth incorporates FileDict, a Python module
|
||||
released under a "MIT/BSD/Python" license, as per [its blog
|
||||
page](https://erezsh.wordpress.com/2009/05/31/filedict-bug-fixes-and-updates/).
|
||||
|
||||
## GNU General Public License, Version 3
|
||||
## GNU Affero General Public License, Version 3
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
@ -31,17 +31,15 @@ page](https://erezsh.wordpress.com/2009/05/31/filedict-bug-fixes-and-updates/).
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
@ -50,44 +48,34 @@ them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
@ -96,7 +84,7 @@ modification follow.
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
@ -573,35 +561,45 @@ to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
@ -659,44 +657,33 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
## Creative Commons Attribution-ShareAlike 3.0 Unported
|
||||
|
||||
License
|
||||
|
||||
226
fabfile.py
vendored
Normal file
226
fabfile.py
vendored
Normal file
@ -0,0 +1,226 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This is the fabric file I've been using to deploy things on my box
|
||||
# and my freedombox.
|
||||
#
|
||||
# fab install should take you from base freedom-maker install to
|
||||
# plinth box
|
||||
|
||||
import os,sys, subprocess
|
||||
import simplejson as json
|
||||
import fabric.api
|
||||
from fabric.api import local, env, cd, put, get, task
|
||||
|
||||
import cfg
|
||||
|
||||
fb_ip = "10.5.53.155"
|
||||
|
||||
BINDIR = "/usr/local/bin"
|
||||
|
||||
# defaults
|
||||
env.user = 'root'
|
||||
|
||||
@task
|
||||
def fb():
|
||||
"Use this to set host to our freedombox (e.g.: fab fb deploy)"
|
||||
env.hosts = [fb_ip]
|
||||
|
||||
@task
|
||||
def all_hosts():
|
||||
"Use this to set host to both localhost and freedombox"
|
||||
env.hosts = ["localhost", "192.168.2.115"]
|
||||
|
||||
def remote_dir():
|
||||
if env.host == fb_ip:
|
||||
return "/usr/local/share/plinth"
|
||||
else:
|
||||
return "/home/james/src/plinth"
|
||||
|
||||
def run(*args, **kwargs):
|
||||
if env.host == "localhost" or env.host=="127.0.0.1":
|
||||
return local(*args, **kwargs)
|
||||
else:
|
||||
return fabric.api.run(*args, **kwargs)
|
||||
|
||||
def sudo(*args, **kwargs):
|
||||
if env.host == "localhost" or env.host=="127.0.0.1":
|
||||
return run("sudo %s" % args[0], *args[1:], **kwargs)
|
||||
elif env.user == "root":
|
||||
return run(*args, **kwargs)
|
||||
else:
|
||||
return fabric.api.sudo(*args, **kwargs)
|
||||
|
||||
@task
|
||||
def get_remote_data_dir():
|
||||
with cd(remote_dir()):
|
||||
data_dir = run('python -c "import cfg; print cfg.data_dir"')
|
||||
env.remote_data_dir = os.path.join(remote_dir(), data_dir)
|
||||
sudo('mkdir -p %s' % env.remote_data_dir)
|
||||
return env.remote_data_dir
|
||||
|
||||
@task
|
||||
def move_data():
|
||||
"Move install's data dir to where cfg specifies it should be"
|
||||
get_remote_data_dir()
|
||||
with cd(remote_dir()):
|
||||
sudo('mv data %s' % os.path.split(env.remote_data_dir)[0])
|
||||
|
||||
@task
|
||||
def make():
|
||||
"Run the makefile, which generates docs and templates"
|
||||
with cd(remote_dir()):
|
||||
sudo('make')
|
||||
|
||||
def make_link_unless_exists(src, dest):
|
||||
sudo('test -f %s || ln -s %s %s' % (dest, src, dest))
|
||||
|
||||
def link(src, dest):
|
||||
sudo('ln -fs %s %s' % (src, dest))
|
||||
|
||||
@task
|
||||
def santiago():
|
||||
"Setup the Santiago port"
|
||||
santiago_port = 52854
|
||||
sudo('ifconfig lo up') # or else tor start fails
|
||||
sudo('apt-get install -y --no-install-recommends tor curl ntp')
|
||||
|
||||
# tor needs accurate clock
|
||||
sudo('date -s "%s"' % subprocess.check_output("date").rstrip())
|
||||
|
||||
# create tor hidden service dir
|
||||
santiago_dir = os.path.join(get_remote_data_dir(), "santiago", "tor")
|
||||
tor_dir = os.path.join(santiago_dir, "general")
|
||||
sudo("mkdir -p " + tor_dir)
|
||||
sudo("chown debian-tor:debian-tor " + tor_dir)
|
||||
|
||||
# ensure hidden service config is in torrc
|
||||
local("rm -rf __fab__torrc")
|
||||
get("/etc/tor/torrc", "__fab__torrc")
|
||||
with open ("__fab__torrc", 'r') as INF:
|
||||
rc = INF.read()
|
||||
local("rm -rf __fab__torrc")
|
||||
hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (tor_dir, santiago_port)
|
||||
if not hidden_service_config in rc:
|
||||
sudo("echo '%s' >> /etc/tor/torrc" % hidden_service_config)
|
||||
|
||||
sudo('service tor restart')
|
||||
|
||||
def backslash_path(f):
|
||||
if not f.startswith('/'):
|
||||
f = os.path.abs(f)
|
||||
if f == '/':
|
||||
return ''
|
||||
path, ret = os.path.split(f)
|
||||
return backslash_path(path) + '\/' + ret
|
||||
|
||||
@task
|
||||
def apache():
|
||||
"configure apache to find reverse proxy for plinth"
|
||||
sudo('apt-get install --no-install-recommends -y apache2 libapache2-mod-proxy-html apache2-utils openssl ssl-cert')
|
||||
sudo('a2enmod proxy_http rewrite ssl')
|
||||
sudo('touch /var/log/apache2/rewrite.log')
|
||||
|
||||
## ssl key and cert
|
||||
ssl_target = "/etc/apache2/ssl/apache.pem"
|
||||
sudo('mkdir -p %s' % os.path.split(ssl_target)[0])
|
||||
sudo('test -f %s || echo "US\nNY\nNYC\nFBox\n\n\n" | openssl req -new -x509 -days 999 -nodes -out %s -keyout %s' % (ssl_target, ssl_target, ssl_target))
|
||||
|
||||
conf_path = os.path.join(remote_dir(), "share/apache2/plinth.conf")
|
||||
sudo("mkdir -p " + os.path.split(conf_path)[0])
|
||||
sudo("touch "+ conf_path)
|
||||
sudo(r"sed -i 's/\(\s*\)DocumentRoot.*/\1DocumentRoot %s/g' %s" % (
|
||||
backslash_path(os.path.join(remote_dir(), "static")),
|
||||
conf_path))
|
||||
link(conf_path, "/etc/apache2/sites-enabled/plinth.conf")
|
||||
sudo('rm -f /etc/apache2/sites-enabled/000-default')
|
||||
sudo('service apache2 restart')
|
||||
|
||||
@task
|
||||
def deps():
|
||||
"Basic plinth dependencies"
|
||||
sudo('apt-get install --no-install-recommends -y python make python-cheetah pandoc python-simplejson python-pyme')
|
||||
|
||||
@task
|
||||
def update():
|
||||
"Copy modified git-tracked files from this branch to remote"
|
||||
|
||||
with cd(remote_dir()):
|
||||
|
||||
## Get .fab contents
|
||||
sudo("touch .fab")
|
||||
fab = run("cat .fab")
|
||||
if not fab:
|
||||
fab = {}
|
||||
|
||||
## Make list of files to put
|
||||
try:
|
||||
fab = json.loads(fab)
|
||||
except:
|
||||
fab={}
|
||||
branch = [a[2:] for a in local("git branch", capture=True).split("\n") if a.startswith('*')][0]
|
||||
files = local("git ls-tree -r --name-only %s" % branch, capture=True).split("\n")
|
||||
else:
|
||||
files = local("git diff --stat " + fab['last_update_from_commit'], capture=True).split("\n")[:-1]
|
||||
files = [f.lstrip().split("|")[0].rstrip() for f in files]
|
||||
|
||||
## Put the files, one by one, respecting directories
|
||||
dirs = {}
|
||||
for pathspec in files:
|
||||
d,fname = os.path.split(pathspec)
|
||||
if not d in dirs.keys():
|
||||
dirs[d]=[]
|
||||
dirs[d].append(pathspec)
|
||||
if dirs:
|
||||
sudo('mkdir -p %s' % ' '.join([os.path.join(remote_dir(), d) for d in dirs.keys()]))
|
||||
for d in dirs:
|
||||
for f in dirs[d]:
|
||||
if os.path.islink(f):
|
||||
linked = local("ls -l %s" % f, capture=True).split("-> ")[1]
|
||||
#link(os.path.join(remote_dir(), linked), os.path.join(remote_dir(), d, os.path.basename(f)))
|
||||
put(f, os.path.join(remote_dir(), d),mirror_local_mode=True)
|
||||
if f.endswith(".py"):
|
||||
run("rm -f " + os.path.join(remote_dir(), d, os.path.basename)+"c")
|
||||
|
||||
## restart
|
||||
make()
|
||||
sudo('/etc/init.d/plinth restart')
|
||||
|
||||
## Record activity so we only put changed files next time
|
||||
commit = local("git log -n 1", capture=True).split("\n")[0].split(" ")[1]
|
||||
fab['last_update_from_commit'] = commit
|
||||
with open(".fab", 'w') as OUTF:
|
||||
OUTF.write(json.dumps(fab))
|
||||
put(".fab", os.path.join(remote_dir(),".fab"))
|
||||
local("rm -f .fab")
|
||||
|
||||
@task
|
||||
def link_bin():
|
||||
"Link executable and init.d script"
|
||||
# todo: set daemon to point to currect binary
|
||||
sudo('rm -rf ' + os.path.join(BINDIR, 'plinth.py'))
|
||||
link(os.path.join(remote_dir(), "plinth.py"), os.path.join(BINDIR, 'plinth.py'))
|
||||
sudo('rm -rf /etc/init.d/plinth')
|
||||
link(os.path.join(remote_dir(), "share/init.d/plinth"), "/etc/init.d/plinth")
|
||||
|
||||
@task
|
||||
def restart():
|
||||
"Run plinth"
|
||||
run('/etc/init.d/plinth restart')
|
||||
@task
|
||||
def stop():
|
||||
"Stop plinth"
|
||||
run('/etc/init.d/plinth stop')
|
||||
|
||||
@task
|
||||
def proxy():
|
||||
put("proxy_up.py", remote_dir())
|
||||
|
||||
@task
|
||||
def deploy():
|
||||
"Deploy plinth"
|
||||
deps()
|
||||
link_bin()
|
||||
santiago()
|
||||
update()
|
||||
apache()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user