Skip to content

Commit 8ca7ac2

Browse files
author
Aaron Murray
committed
initial commit
1 parent 5f63a5d commit 8ca7ac2

27 files changed

+1925
-0
lines changed

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
3+
*.gif binary
4+
*.jpg binary
5+
*.png binary

.gitignore

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#################
2+
## IDEA
3+
#################
4+
.idea/
5+
6+
7+
#################
8+
## Eclipse
9+
#################
10+
11+
*.pydevproject
12+
.project
13+
.metadata
14+
bin/**
15+
tmp/**
16+
tmp/**/*
17+
*.tmp
18+
*.bak
19+
*.swp
20+
*~.nib
21+
local.properties
22+
.classpath
23+
.settings/
24+
.loadpath
25+
26+
# External tool builders
27+
.externalToolBuilders/
28+
29+
# Locally stored "Eclipse launch configurations"
30+
*.launch
31+
32+
# CDT-specific
33+
.cproject
34+
35+
# PDT-specific
36+
.buildpath
37+
38+
39+
############
40+
## Windows
41+
############
42+
43+
# Windows image file caches
44+
Thumbs.db
45+
46+
# Folder config file
47+
Desktop.ini
48+
49+
# Mac crap
50+
.DS_Store
51+
52+
# Files created by building the deb package
53+
debian/openmediavault-mysql
54+
debian/files
55+
debian/*.debhelper.log
56+
debian/*.debhelper
57+
debian/*substvars
58+
/sqlbuddy

build_snapraid

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
rm -f usr/local/bin/snapraid
4+
wget http://sourceforge.net/projects/snapraid/files/snapraid-4.4.tar.gz/download -O snapraid-4.4.tar.gz
5+
tar xzf snapraid-4.4.tar.gz
6+
/bin/rm -f snapraid-4.4.tar.gz
7+
cd snapraid-4.4
8+
./configure
9+
make
10+
cp snapraid ../usr/local/bin/
11+
rm -rf snapraid-4.4

create_pot

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
POT_DIR="usr/share/openmediavault/locale/"
2+
3+
mkdir -p ${POT_DIR}
4+
5+
pwd=${PWD##*/}
6+
edit_date=$(date +%Y-%m-%d\ %H:%M)
7+
8+
grep -Poh '(?<=\_\(\").*?(?=\"\))' ./var/www/openmediavault/js/omv/module/admin/service/snapraid/*.js | sort -u > strings
9+
10+
cat strings* | sort -u > pot_strings
11+
12+
cat <<EOF > ${POT_DIR}${pwd}.pot
13+
# ${pwd}
14+
# Copyright (C) 2013
15+
# This file is distributed under the same license as the PACKAGE package.
16+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
17+
#
18+
#, fuzzy
19+
msgid ""
20+
msgstr ""
21+
"Project-Id-Version: ${pwd}\n"
22+
"Report-Msgid-Bugs-To: \n"
23+
"POT-Creation-Date: ${edit_date}-0500\n"
24+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
25+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
26+
"Language-Team: LANGUAGE <[email protected]>\n"
27+
"Language: \n"
28+
"MIME-Version: 1.0\n"
29+
"Content-Type: text/plain; charset=CHARSET\n"
30+
"Content-Transfer-Encoding: 8bit\n"
31+
32+
EOF
33+
34+
35+
while read line
36+
do
37+
echo -e "msgid \"${line}\"\nmsgstr \"${line}\"\n" >> ${POT_DIR}${pwd}.pot
38+
done < "pot_strings"
39+
40+
rm strings*
41+
rm pot_strings

debian/changelog

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openmediavault-snapraid (0.5) stable; urgency=low
2+
3+
* Initial release for OMV 0.5
4+
5+
-- OpenMediaVault Plugin Developers <[email protected]> Tue, 05 Nov 2013 07:52:27 -0500

debian/compat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7

debian/control

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Source: openmediavault-snapraid
2+
Section: net
3+
Priority: optional
4+
Maintainer: OpenMediaVault Plugin Developers <[email protected]>
5+
Build-Depends: debhelper (>= 8.0.0)
6+
Standards-Version: 3.9.3
7+
8+
Package: openmediavault-snapraid
9+
Architecture: all
10+
Depends: openmediavault (>= 0.5.14)
11+
Description: snapraid plugin for OpenMediaVault.

debian/copyright

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Format: http://dep.debian.net/deps/dep5
2+
Upstream-Contact: OpenMediaVault Plugin Developers <[email protected]>
3+
Copyright: 2013 OpenMediaVault Plugin Developers <[email protected]>
4+
License: GPL-3
5+
6+
Files: /var/www/openmediavault/images/snapraid.png
7+
/var/www/openmediavault/images/snapraid.svg
8+
Copyright: IcoMoon <http://www.icomoon.io>
9+
IcoMoon <http://www.icomoon.io>

debian/install

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
usr/share/openmediavault/* usr/share/openmediavault
2+
usr/local/bin/* usr/local/bin
3+
var/www/openmediavault/* var/www/openmediavault

debian/postinst

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
. /etc/default/openmediavault
6+
. /usr/share/openmediavault/scripts/helper-functions
7+
8+
case "$1" in
9+
configure)
10+
11+
if ! omv_config_exists "/config/services/snapraid"; then
12+
echo "Initial configuration."
13+
object="<parity>0</parity>"
14+
object="${object}<mntentref></mntentref>"
15+
object="${object}<qparity></qparity>"
16+
object="${object}<qmntentref></qmntentref>"
17+
object="${object}<blocksize>256</blocksize>"
18+
object="${object}<nohidden>0</nohidden>"
19+
object="${object}<contents></contents>"
20+
object="${object}<datas></datas>"
21+
object="${object}<excludes></excludes>"
22+
omv_config_add_element "/config/services" "snapraid" "${object}" true
23+
fi
24+
25+
omv_install_fixperms
26+
;;
27+
abort-upgrade|abort-remove|abort-deconfigure)
28+
;;
29+
*)
30+
echo "postinst called with unknown argument" >&2
31+
exit 1
32+
;;
33+
esac
34+
35+
#DEBHELPER#
36+
37+
exit 0

debian/postrm

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
. /etc/default/openmediavault
6+
. /usr/share/openmediavault/scripts/helper-functions
7+
8+
case "$1" in
9+
purge)
10+
omv_config_delete "//services/snapraid"
11+
12+
;;
13+
14+
remove)
15+
16+
;;
17+
18+
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
19+
;;
20+
21+
*)
22+
echo "postrm called with unknown argument \`$1'" >&2
23+
exit 1
24+
;;
25+
esac
26+
27+
#DEBHELPER#
28+
29+
exit 0

debian/rules

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/make -f
2+
3+
include ./openmediavault.mk
4+
5+
clean:
6+
dh_testdir
7+
dh_testroot
8+
dh_clean
9+
10+
install:
11+
dh_testdir
12+
dh_testroot
13+
dh_prep
14+
/bin/sh build_snapraid
15+
/bin/sh create_pot
16+
dh_installdirs
17+
dh_install
18+
19+
binary-indep: install omv_clean_scm
20+
dh_testdir
21+
dh_testroot
22+
dh_installchangelogs
23+
dh_installdebconf
24+
dh_lintian
25+
dh_link
26+
dh_compress
27+
dh_fixperms
28+
dh_installdeb
29+
dh_gencontrol
30+
dh_md5sums
31+
dh_builddeb
32+
33+
binary-arch: install
34+
# We have nothing to do by default.
35+
36+
build:
37+
# We have nothing to do by default.
38+
39+
binary: binary-indep binary-arch
40+
.PHONY: clean binary-indep binary-arch binary install

debian/source/format

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

debian/triggers

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
activate update-locale
2+
activate update-fixperms
3+
activate restart-engined

openmediavault.mk

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# -*- mode: makefile; coding: utf-8 -*-
2+
#
3+
# This file is part of OpenMediaVault.
4+
#
5+
# @license http://www.gnu.org/licenses/gpl.html GPL Version 3
6+
# @author Volker Theile <[email protected]>
7+
# @copyright Copyright (c) 2009-2013 Volker Theile
8+
#
9+
# OpenMediaVault is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License as published by
11+
# the Free Software Foundation, either version 3 of the License, or
12+
# any later version.
13+
#
14+
# OpenMediaVault is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
21+
22+
OMV_PACKAGE := $(shell pwd | sed 's|.*/||')
23+
OMV_POT_DIR := $(CURDIR)/usr/share/openmediavault/locale
24+
OMV_POT_FILE := $(OMV_PACKAGE).pot
25+
OMV_TRANSIFEX_PROJECT_SLUG := openmediavault
26+
27+
omv_pull_po:
28+
tx --root="$(CURDIR)/../" pull --all \
29+
--resource=$(OMV_TRANSIFEX_PROJECT_SLUG).$(OMV_PACKAGE)
30+
31+
omv_push_pot:
32+
tx --root="$(CURDIR)/../" push --source \
33+
--resource=$(OMV_TRANSIFEX_PROJECT_SLUG).$(OMV_PACKAGE)
34+
35+
omv_build_pot:
36+
dh_testdir
37+
dh_clean
38+
echo "Building PO template file ..." >&2
39+
mkdir -p $(OMV_POT_DIR)
40+
find $(CURDIR) \( -iname *.js -o -iname *.php -o -iname *.inc \) \
41+
-type f -print0 | xargs -0r xgettext --keyword=_ \
42+
--output-dir=$(OMV_POT_DIR) --output=$(OMV_POT_FILE) \
43+
--force-po --no-location --no-wrap --sort-output \
44+
--package-name=$(OMV_PACKAGE) -
45+
# Remove '#, c-format' comments, otherwise manuall upload of translation
46+
# files confuses Transifex.
47+
sed --in-place '/^#, c-format/d' $(OMV_POT_DIR)/$(OMV_POT_FILE)
48+
49+
omv_clean_scm:
50+
dh_testdir
51+
echo "Removing SCM files ..." >&2
52+
find $(CURDIR)/debian/$(OMV_PACKAGE) \( -name .svn -o -name .git \) \
53+
-type d -print0 -prune | xargs -0r rm -rf
54+
55+
omv_build_doc: debian/doxygen.conf
56+
mkdir -p debian/doxygen
57+
doxygen $<
58+
59+
.PHONY: omv_pull_po omv_push_pot omv_build_pot omv_clean_scm omv_build_doc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright (C) 2013 OpenMediaVault Plugin Developers
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
require_once "openmediavault/module.inc";
20+
require_once "openmediavault/config.inc";
21+
require_once "openmediavault/error.inc";
22+
require_once "openmediavault/util.inc";
23+
require_once "openmediavault/initscript.inc";
24+
25+
class OMVModuleSnapRaid extends OMVModuleServiceAbstract implements OMVINotifyListener {
26+
27+
private function getXPath() {
28+
return '//services/snapraid';
29+
}
30+
31+
public function getName() {
32+
return "snapraid";
33+
}
34+
35+
public function applyConfig() {
36+
global $xmlConfig;
37+
38+
$config = $xmlConfig->get($this->getXPath());
39+
40+
if (is_null($config))
41+
throw new OMVException(OMVErrorMsg::E_CONFIG_GET_OBJECT_FAILED, $this->getXPath());
42+
43+
$cmd = "sudo omv-mkconf snapraid 2>&1";
44+
45+
if (0 !== $this->exec($cmd, $output))
46+
throw new OMVException(OMVErrorMsg::E_EXEC_FAILED, $cmd, implode("\n", $output));
47+
}
48+
49+
public function bindListeners(OMVNotifyDispatcher $dispatcher) {
50+
$dispatcher->addListener(
51+
OMV_NOTIFY_MODIFY,
52+
"org.openmediavault.services.snapraid",
53+
array($this, "setDirty"));
54+
}
55+
}
56+
57+
// Register module
58+
$moduleMgr = &OMVModuleMgr::getInstance();
59+
$moduleMgr->registerModule(new OMVModuleSnapRaid());

0 commit comments

Comments
 (0)