owncloud-admin 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -0
- data/bin/owncloud-admin +21 -0
- data/lib/cli.rb +36 -10
- data/lib/installer.rb +56 -3
- data/lib/owncloud-admin.rb +20 -1
- data/lib/settings.rb +19 -0
- data/lib/version.rb +20 -1
- metadata +5 -4
data/README
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# owncloud-admin - the ownCloud administration tool
|
2
|
+
|
3
|
+
owncloud-admin is a simple command line tool to make administration of ownCloud
|
4
|
+
servers easier. It's primary purpose is installing an ownCloud instance.
|
5
|
+
|
6
|
+
If you have questions or comments please contact Cornelius Schumacher
|
7
|
+
<schumacher@kde.org>.
|
data/bin/owncloud-admin
CHANGED
@@ -1,7 +1,28 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# owncloud-admin - the owncloud administration tool
|
4
|
+
#
|
5
|
+
# Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License along
|
18
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
19
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2
20
|
|
3
21
|
require File.expand_path('../../lib/owncloud-admin',__FILE__)
|
4
22
|
|
23
|
+
# Don't buffer output, so output progress is smooth, when called from desktop
|
24
|
+
$stdout.sync = true
|
25
|
+
|
5
26
|
Cli.settings = Settings.new
|
6
27
|
|
7
28
|
Cli.check_unknown_options!
|
data/lib/cli.rb
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# owncloud-admin - the owncloud administration tool
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License along
|
17
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
|
1
20
|
class Cli < Thor
|
2
21
|
|
3
22
|
default_task :global
|
@@ -36,40 +55,47 @@ class Cli < Thor
|
|
36
55
|
|
37
56
|
desc "install", "Install ownCloud server"
|
38
57
|
method_option :server_type, :type => :string,
|
39
|
-
:desc => "Server type",
|
58
|
+
:desc => "Server type (#{Installer.server_types.join(", ")})",
|
59
|
+
:required => true
|
40
60
|
method_option :server, :type => :string,
|
41
61
|
:desc => "Server name", :required => false
|
42
|
-
method_option :
|
43
|
-
:desc => "
|
44
|
-
method_option :
|
45
|
-
:desc => "
|
62
|
+
method_option :ftp_user, :type => :string,
|
63
|
+
:desc => "FTP user name", :required => false
|
64
|
+
method_option :ftp_password, :type => :string,
|
65
|
+
:desc => "FTP password", :required => false
|
46
66
|
method_option :root_helper, :type => :string,
|
47
67
|
:desc => "Helper to call to run command as root (use 'kdesu -c' for GUI)",
|
48
68
|
:required => false
|
49
69
|
method_option :skip_download, :type => :boolean,
|
50
70
|
:desc => "Skip download of owncloud sources", :required => false
|
71
|
+
method_option :admin_user, :type => :string,
|
72
|
+
:desc => "Name of ownCloud admin user (defaults to $USER)",
|
73
|
+
:required => false
|
74
|
+
method_option :admin_password, :type => :string,
|
75
|
+
:desc => "Initial admin password", :required => true
|
51
76
|
def install
|
52
77
|
installer = Installer.new @@settings
|
53
78
|
|
54
79
|
installer.skip_download = options["skip_download"]
|
55
80
|
|
56
81
|
installer.server = options["server"]
|
57
|
-
installer.
|
58
|
-
installer.
|
82
|
+
installer.ftp_user = options["ftp_user"]
|
83
|
+
installer.ftp_password = options["ftp_password"]
|
59
84
|
if options["root_helper"]
|
60
85
|
installer.root_helper = options["root_helper"]
|
61
86
|
else
|
62
87
|
installer.root_helper = "sudo bash -c"
|
63
88
|
end
|
89
|
+
installer.admin_user = options["admin_user"]
|
90
|
+
installer.admin_password = options["admin_password"]
|
64
91
|
|
65
92
|
server_type = options["server_type"]
|
66
93
|
|
67
|
-
server_types
|
68
|
-
if server_types.include? server_type
|
94
|
+
if Installer.server_types.include? server_type
|
69
95
|
installer.install server_type
|
70
96
|
else
|
71
97
|
STDERR.puts "Unsupported server type '#{server_type}."
|
72
|
-
STDERR.puts "Supported types are: #{server_types.join}."
|
98
|
+
STDERR.puts "Supported types are: #{Installer.server_types.join(", ")}."
|
73
99
|
exit 1
|
74
100
|
end
|
75
101
|
end
|
data/lib/installer.rb
CHANGED
@@ -1,11 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# owncloud-admin - the owncloud administration tool
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License along
|
17
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
|
1
20
|
class Installer
|
2
21
|
|
3
|
-
attr_accessor :server, :
|
22
|
+
attr_accessor :server, :ftp_user, :ftp_password, :skip_download, :root_helper,
|
23
|
+
:admin_user, :admin_password
|
4
24
|
|
5
25
|
def initialize settings
|
6
26
|
@settings = settings
|
7
27
|
end
|
8
28
|
|
29
|
+
def self.server_types
|
30
|
+
[ "local", "ftp" ]
|
31
|
+
end
|
32
|
+
|
9
33
|
def install server_type
|
10
34
|
if !skip_download
|
11
35
|
source = {
|
@@ -29,6 +53,8 @@ class Installer
|
|
29
53
|
end
|
30
54
|
|
31
55
|
@source_dir = @settings.tmp_dir + "owncloud"
|
56
|
+
|
57
|
+
write_admin_config
|
32
58
|
|
33
59
|
if server_type == "local"
|
34
60
|
install_local
|
@@ -40,6 +66,33 @@ class Installer
|
|
40
66
|
end
|
41
67
|
end
|
42
68
|
|
69
|
+
def write_admin_config
|
70
|
+
if !@admin_password
|
71
|
+
STDERR.puts "Initial admin password is required"
|
72
|
+
exit 1
|
73
|
+
end
|
74
|
+
if !@admin_user
|
75
|
+
@admin_user = ENV["USER"]
|
76
|
+
end
|
77
|
+
|
78
|
+
config = <<EOF
|
79
|
+
<?php
|
80
|
+
$AUTOCONFIG = array(
|
81
|
+
"dbtype" => 'sqlite',
|
82
|
+
"directory" => OC::$SERVERROOT."/data",
|
83
|
+
"adminlogin" => "#{@admin_user}",
|
84
|
+
"adminpass" => "#{@admin_password}"
|
85
|
+
);
|
86
|
+
?>
|
87
|
+
EOF
|
88
|
+
|
89
|
+
config_file = @source_dir + "/config/autoconfig.php"
|
90
|
+
|
91
|
+
File.open config_file, "w" do |file|
|
92
|
+
file.print config
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
43
96
|
def install_local
|
44
97
|
# Requirements for ownCloud to run:
|
45
98
|
# * packages installed: apache2, apache2-mod_php5, php5-json, php5-dom,
|
@@ -56,12 +109,12 @@ class Installer
|
|
56
109
|
def install_ftp
|
57
110
|
puts "Installing owncloud to remote web server via FTP..."
|
58
111
|
|
59
|
-
assert_options [ :server, :
|
112
|
+
assert_options [ :server, :ftp_user, :ftp_password ]
|
60
113
|
|
61
114
|
ftp = Net::FTP.new( server )
|
62
115
|
ftp.passive = true
|
63
116
|
puts " Logging in..."
|
64
|
-
ftp.login
|
117
|
+
ftp.login ftp_user, ftp_password
|
65
118
|
|
66
119
|
puts " Finding installation directory..."
|
67
120
|
install_dir = ""
|
data/lib/owncloud-admin.rb
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# owncloud-admin - the owncloud administration tool
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License along
|
17
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
|
1
20
|
require "rubygems"
|
2
21
|
|
3
22
|
require "thor"
|
@@ -5,6 +24,6 @@ require "net/http"
|
|
5
24
|
require "net/ftp"
|
6
25
|
|
7
26
|
require File.expand_path('../version', __FILE__)
|
27
|
+
require File.expand_path('../installer', __FILE__) # must be before cli
|
8
28
|
require File.expand_path('../cli', __FILE__)
|
9
29
|
require File.expand_path('../settings', __FILE__)
|
10
|
-
require File.expand_path('../installer', __FILE__)
|
data/lib/settings.rb
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# owncloud-admin - the owncloud administration tool
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License along
|
17
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
|
1
20
|
class Settings
|
2
21
|
|
3
22
|
def version
|
data/lib/version.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# owncloud-admin - the owncloud administration tool
|
3
|
+
#
|
4
|
+
# Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; either version 2 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License along
|
17
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
19
|
+
|
1
20
|
module OwncloudAdmin
|
2
21
|
|
3
|
-
VERSION = "0.0.
|
22
|
+
VERSION = "0.0.3"
|
4
23
|
|
5
24
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: owncloud-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cornelius Schumacher
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-28 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -46,6 +46,7 @@ extra_rdoc_files: []
|
|
46
46
|
files:
|
47
47
|
- .gitignore
|
48
48
|
- COPYING
|
49
|
+
- README
|
49
50
|
- TODO
|
50
51
|
- bin/owncloud-admin
|
51
52
|
- lib/cli.rb
|