Commit 3eccb92e authored by Ted Trask's avatar Ted Trask
Browse files

Added mdadm controller with basic functionality.

git-svn-id: svn://svn.alpinelinux.org/acf/mdadm/trunk@1659 ab2d0c66-481e-0410-8bed-d214d4d58bed
parents
APP_NAME=mdadm
PACKAGE=acf-$(APP_NAME)
VERSION=0.1.0
APP_DIST=\
mdadm* \
EXTRA_DIST=README Makefile config.mk
DISTFILES=$(APP_DIST) $(EXTRA_DIST)
TAR=tar
P=$(PACKAGE)-$(VERSION)
tarball=$(P).tar.bz2
install_dir=$(DESTDIR)/$(appdir)/$(APP_NAME)
all:
clean:
rm -rf $(tarball) $(P)
dist: $(tarball)
install:
mkdir -p "$(install_dir)"
cp -a $(APP_DIST) "$(install_dir)"
$(tarball): $(DISTFILES)
rm -rf $(P)
mkdir -p $(P)
cp -a $(DISTFILES) $(P)
$(TAR) -jcf $@ $(P)
rm -rf $(P)
# target that creates a tar package, unpacks is and install from package
dist-install: $(tarball)
$(TAR) -jxf $(tarball)
$(MAKE) -C $(P) install DESTDIR=$(DESTDIR)
rm -rf $(P)
include config.mk
.PHONY: all clean dist install dist-install
ACF for mdadm
prefix=/usr
datadir=${prefix}/share
sysconfdir=${prefix}/etc
localstatedir=${prefix}/var
acfdir=${datadir}/acf
wwwdir=${acfdir}/www
cgibindir=${acfdir}/cgi-bin
appdir=${acfdir}/app
acflibdir=${acfdir}/lib
sessionsdir=${localstatedir}/lib/acf/sessions
module(..., package.seeall)
-- Load libraries
require("controllerfunctions")
default_action = "status"
function status(self)
return self.model.getstatus()
end
function startstop(self)
return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata)
end
function details(self)
return self.model.getstatusdetails()
end
function expert(self)
return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit MDADM Config", "Configuration Set")
end
<% local data, viewlibrary = ...
require("viewfunctions")
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(data))
io.write("</span>")
--]]
%>
<% viewlibrary.dispatch_component("status") %>
<H2><%= data.label %></H2>
<DL>
<%
displayitem(data)
%>
</DL>
../expert-html.lsp
\ No newline at end of file
<% local data, viewlibrary = ...
require("viewfunctions")
%>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {name="/var/log/messages", grep="mdadm"})
end %>
module(..., package.seeall)
-- Load libraries
require("modelfunctions")
require("fs")
require("format")
-- Set variables
local configfile = "/etc/mdadm.conf"
local processname = "mdadm-raid"
local packagename = "mdadm"
local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin "
-- ################################################################################
-- LOCAL FUNCTIONS
-- ################################################################################
-- PUBLIC FUNCTIONS
function startstop_service(action)
return modelfunctions.startstop_service(processname, action)
end
function getstatus()
return modelfunctions.getstatus(processname, packagename, "MDADM Status")
end
function getstatusdetails()
return cfe({ type="longtext", value=fs.read_file("/proc/mdstat") or "", label="MDADM Status Details" })
end
function get_filedetails()
return modelfunctions.getfiledetails(configfile)
end
function update_filedetails(filedetails)
return modelfunctions.setfiledetails(filedetails, {configfile})
end
../startstop-html.lsp
\ No newline at end of file
../status-html.lsp
\ No newline at end of file
#CAT GROUP/DESC TAB ACTION
Storage 45MDADM Status details
Storage 45MDADM Expert expert
Storage 45MDADM Logfile logfile
USER=mdadm:status,mdadm:logfile,mdadm:details,mdadm:startstop
EXPERT=mdadm:expert
ADMIN=mdadm:status,mdadm:logfile,mdadm:details,mdadm:startstop,mdadm:expert
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment