core updated.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed under the GNU General Public License, version 3.
|
||||
# See the file http://www.gnu.org/licenses/gpl.txt
|
||||
|
||||
from pisi.actionsapi import get
|
||||
from pisi.actionsapi import autotools
|
||||
from pisi.actionsapi import pisitools
|
||||
from pisi.actionsapi import shelltools
|
||||
|
||||
def builddiet():
|
||||
autotools.make("clean")
|
||||
shelltools.export("CC", "diet %s %s %s %s -DHAVE_STDINT_H -Os -static" % (get.CC(), get.CFLAGS(), get.CXXFLAGS(), get.LDFLAGS()))
|
||||
autotools.make("mdadm.static")
|
||||
autotools.make("mdassemble.static")
|
||||
|
||||
pisitools.insinto("/sbin", "mdadm.static")
|
||||
pisitools.insinto("/sbin", "mdassemble.static")
|
||||
|
||||
def build():
|
||||
# fix build with gcc-4.9.0
|
||||
pisitools.dosed("Makefile", "(Wall) -Werror", "\\1")
|
||||
# Not sure about MDASSEMBLE_AUTO=1. Need to investigate.
|
||||
autotools.make("SYSCONFDIR=/%s MDASSEMBLE_AUTO=1 mdassemble mdadm mdmon" % get.confDIR())
|
||||
|
||||
def install():
|
||||
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
|
||||
|
||||
# Remove the udev file as its shipped with udev package
|
||||
pisitools.remove("/lib/udev/rules.d/*")
|
||||
|
||||
# Install config file
|
||||
pisitools.insinto("/etc", "mdadm.conf-example", "mdadm.conf")
|
||||
|
||||
builddiet()
|
||||
|
||||
pisitools.dodoc("TODO", "ChangeLog", "COPYING", "mdadm.conf-example", "misc/*")
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
from comar.service import *
|
||||
|
||||
serviceType = "server"
|
||||
serviceDesc = _({"en": "RAID monitor daemon",
|
||||
"tr": "RAID izleme servisi"})
|
||||
serviceConf = "mdadm"
|
||||
|
||||
MSG_ERR_STRTSRVC = {"en": "Couldn't start service.Please edit mdadm.conf file.",
|
||||
"tr": "Servis başlatılamadı.Lütfen mdadm.conf dosyasını düzenleyiniz.",
|
||||
}
|
||||
|
||||
def check():
|
||||
try:
|
||||
f = file("/etc/mdadm.conf")
|
||||
confLines = [a.lstrip() for a in f]
|
||||
confLines = filter(lambda x: not (x.startswith("\#") or x == ""), confLines)
|
||||
check = False
|
||||
for line in confLines:
|
||||
if "MAILADDR" or "PROGRAM" in line.split():
|
||||
check = True
|
||||
if not check:
|
||||
fail(MSG_ERR_STRTSRVC)
|
||||
except:
|
||||
fail(MSG_ERR_STRTSRVC)
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
@synchronized
|
||||
def start():
|
||||
check()
|
||||
startService(command="/sbin/mdadm",
|
||||
args="--monitor --scan --daemonise --pid-file /run/mdadm.pid %s" % config.get("MDADM_OPTS"),
|
||||
pidfile="/run/mdadm.pid",
|
||||
donotify=True)
|
||||
|
||||
@synchronized
|
||||
def stop():
|
||||
stopService(pidfile="/run/mdadm.pid",
|
||||
donotify=True)
|
||||
|
||||
def status():
|
||||
return isServiceRunning("/run/mdadm.pid")
|
||||
@@ -0,0 +1,7 @@
|
||||
# config file for mdadm
|
||||
|
||||
# Misc options to pass to mdadm in monitor mode.
|
||||
# For more info, run `mdadm --monitor --help` or see
|
||||
# the mdadm(8) manpage.
|
||||
|
||||
MDADM_OPTS="--syslog"
|
||||
@@ -0,0 +1,8 @@
|
||||
# This file causes block devices with Linux RAID (mdadm) signatures to
|
||||
# automatically cause mdadm to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
|
||||
IMPORT{program}="/sbin/mdadm --examine --export $tempnode", \
|
||||
RUN+="/bin/bash -c '[ ! -f /dev/.in_sysinit ] && mdadm -I $env{DEVNAME}'"
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=MDADM Event Monitor
|
||||
|
||||
[Service]
|
||||
ExecStart=/sbin/mdadm --monitor --scan
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1 @@
|
||||
d /run/mdadm 0710 root root -
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
for dev in `grep "^md.*: active" /proc/mdstat | cut -f 1 -d ' '`; do
|
||||
echo "repair" > /sys/block/$dev/md/sync_action
|
||||
done
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
[[ -f /proc/mdstat ]] || exit 0
|
||||
|
||||
# Try to make sure the devices exist before we use them
|
||||
create_devs() {
|
||||
local node dir minor
|
||||
for node in $@ ; do
|
||||
[[ ${node} != /dev/* ]] && node=/dev/${node}
|
||||
[[ -e ${node} ]] && continue
|
||||
|
||||
dir=${node%/*}
|
||||
[[ ! -d ${dir} ]] && mkdir -p "${dir}"
|
||||
|
||||
minor=${node##*/}
|
||||
mknod "${node}" b ${MAJOR} ${minor##*md} &> /dev/null
|
||||
done
|
||||
}
|
||||
|
||||
[[ -e /etc/mdadm.conf ]] && mdadm_conf="/etc/mdadm.conf"
|
||||
if [[ -x /sbin/mdadm && -f ${mdadm_conf} ]] ; then
|
||||
devs=$(awk '/^[[:space:]]*ARRAY/ { print $2 }' ${mdadm_conf})
|
||||
if [[ -n ${devs} ]] ; then
|
||||
create_devs ${devs}
|
||||
ebegin "Starting up RAID devices (mdadm)"
|
||||
output=$(mdadm -As 2>&1)
|
||||
ret=$?
|
||||
[[ ${ret} -ne 0 ]] && echo "${output}"
|
||||
eend ${ret}
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,10 @@
|
||||
[[ -f /proc/mdstat ]] || exit 0
|
||||
|
||||
[[ -e /etc/mdadm.conf ]] && mdadm_conf="/etc/mdadm.conf"
|
||||
if [[ -x /sbin/mdadm && -f ${mdadm_conf} ]] ; then
|
||||
ebegin "Shutting down RAID devices (mdadm)"
|
||||
output=$(mdadm -Ss 2>&1)
|
||||
ret=$?
|
||||
[[ ${ret} -ne 0 ]] && echo "${output}"
|
||||
eend ${ret}
|
||||
fi
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>mdadm</Name>
|
||||
<Homepage>http://www.kernel.org/pub/linux/utils/raid/mdadm</Homepage>
|
||||
<Packager>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Packager>
|
||||
<License>GPLv2</License>
|
||||
<IsA>app:console</IsA>
|
||||
<Summary>Utility to control Linux MD devices (software RAID arrays)</Summary>
|
||||
<Description>mdadm is used to create, manage, and monitor Linux MD (software RAID) devices.</Description>
|
||||
<Archive sha1sum="c649601d84553501c2f3b452cf93d1fbc53f976a" type="tarxz">https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-3.3.2.tar.xz</Archive>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>mdadm</Name>
|
||||
<Files>
|
||||
<Path fileType="executable">/sbin/mdadm</Path>
|
||||
<Path fileType="executable">/sbin/mdmon</Path>
|
||||
<Path fileType="data">/lib/udev/rules.d</Path>
|
||||
<Path fileType="data">/usr/lib/tmpfiles.d</Path>
|
||||
<Path fileType="man">/usr/share/man</Path>
|
||||
<Path fileType="doc">/usr/share/doc</Path>
|
||||
<Path fileType="config">/etc</Path>
|
||||
</Files>
|
||||
<AdditionalFiles>
|
||||
<AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/mdadm.conf">mdadm.tmpfiles.conf</AdditionalFile>
|
||||
<!-- Add a cron job to run a weekly repair of the array to correct bad sectors -->
|
||||
<AdditionalFile owner="root" permission="0755" target="/etc/cron.weekly/raid-check">scripts/raid-check</AdditionalFile>
|
||||
|
||||
<AdditionalFile owner="root" permission="0644" target="/etc/conf.d/mdadm">mdadm.confd</AdditionalFile>
|
||||
|
||||
<!-- Udev rules file for device assembly. This is different than the mdadm rules file shipped with udev -->
|
||||
<AdditionalFile owner="root" permission="0644" target="/lib/udev/rules.d/65-md-incremental.rules">mdadm.rules</AdditionalFile>
|
||||
</AdditionalFiles>
|
||||
<Provides>
|
||||
<COMAR script="service.py">System.Service</COMAR>
|
||||
</Provides>
|
||||
</Package>
|
||||
|
||||
<Package>
|
||||
<Name>mdadm-static</Name>
|
||||
<PartOf>system.base</PartOf>
|
||||
<Files>
|
||||
<Path fileType="executable">/sbin/mdadm.static</Path>
|
||||
<Path fileType="executable">/sbin/mdassemble.static</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="5">
|
||||
<Date>2014-12-13</Date>
|
||||
<Version>3.3.2</Version>
|
||||
<Comment>Version bump.</Comment>
|
||||
<Name>Yusuf Aydemir</Name>
|
||||
<Email>yusuf.aydemir@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="4">
|
||||
<Date>2014-05-17</Date>
|
||||
<Version>3.3</Version>
|
||||
<Comment>Rebuild. Fixed service.py file</Comment>
|
||||
<Name>Aydın Demirel</Name>
|
||||
<Email>aydin.demirel@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="3">
|
||||
<Date>2014-04-13</Date>
|
||||
<Version>3.3</Version>
|
||||
<Comment>mdadm-static is a part of system.base now.</Comment>
|
||||
<Name>Marcin Bojara</Name>
|
||||
<Email>marcin@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="2">
|
||||
<Date>2014-01-31</Date>
|
||||
<Version>3.3</Version>
|
||||
<Comment>Ver. bump, rebuild</Comment>
|
||||
<Name>Kamil Atlı</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Update>
|
||||
<Update release="1">
|
||||
<Date>2012-11-14</Date>
|
||||
<Version>3.2.6</Version>
|
||||
<Comment>First release</Comment>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Update>
|
||||
</History>
|
||||
</PISI>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>mdadm</Name>
|
||||
<Summary xml:lang="tr">MD aygıtlarını (Yazılımsal RAID) denetleme aracı</Summary>
|
||||
<Description xml:lang="tr">mdadm Linux MD (yazılımsal RAID) aygıtları yaratmak, yönetmek ve izlemek için kullanılan bir araçtır.</Description>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>mdadm-static</Name>
|
||||
<Summary xml:lang="tr">Statik linklemiş Raid denetleme aracı</Summary>
|
||||
<Description xml:lang="tr">mdadm Linux MD (yazılımsal RAID) aygıtları yaratmak, yönetmek ve izlemek için kullanılan bir araçtır.</Description>
|
||||
</Package>
|
||||
</PISI>
|
||||
Reference in New Issue
Block a user