From 94e059a29387506ce94af3b395da27a9b5df23e7 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Tue, 12 May 2015 14:26:38 +0200 Subject: [PATCH 1/6] Added types __pacman_integrate: converts normal pacman.conf to cdist conform __pacman_conf: Manage pacman.conf with cdist --- cdist/conf/type/__pacman_conf/man.text | 72 ++++ cdist/conf/type/__pacman_conf/manifest | 111 ++++++ .../type/__pacman_conf/parameter/optional | 2 + .../type/__pacman_conf/parameter/required | 3 + .../type/__pacman_integrate/files/mirrorlist | 344 ++++++++++++++++++ .../type/__pacman_integrate/files/options | 6 + .../files/pacman.conf.cdist | 6 + .../files/pacman.conf.pacman | 99 +++++ cdist/conf/type/__pacman_integrate/man.text | 48 +++ cdist/conf/type/__pacman_integrate/manifest | 46 +++ .../__pacman_integrate/parameter/optional | 1 + 11 files changed, 738 insertions(+) create mode 100644 cdist/conf/type/__pacman_conf/man.text create mode 100644 cdist/conf/type/__pacman_conf/manifest create mode 100644 cdist/conf/type/__pacman_conf/parameter/optional create mode 100644 cdist/conf/type/__pacman_conf/parameter/required create mode 100644 cdist/conf/type/__pacman_integrate/files/mirrorlist create mode 100644 cdist/conf/type/__pacman_integrate/files/options create mode 100644 cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist create mode 100644 cdist/conf/type/__pacman_integrate/files/pacman.conf.pacman create mode 100644 cdist/conf/type/__pacman_integrate/man.text create mode 100644 cdist/conf/type/__pacman_integrate/manifest create mode 100644 cdist/conf/type/__pacman_integrate/parameter/optional diff --git a/cdist/conf/type/__pacman_conf/man.text b/cdist/conf/type/__pacman_conf/man.text new file mode 100644 index 00000000..b4905111 --- /dev/null +++ b/cdist/conf/type/__pacman_conf/man.text @@ -0,0 +1,72 @@ +cdist-type__pacman_conf(7) +=================== +Dominique Roux + + +NAME +---- +cdist-type__pacman_conf - Manage pacman configuration + + +DESCRIPTION +----------- +The type allows you to configure options section, add or delete repositories and manage mirrorlists + + +REQUIRED PARAMETERS +------------------- +section:: + 'options' for configure options section + + Otherwise it specifies a repository or a plain file + +key:: + Specifies the key which will be set + + If section = 'options' or file is not set the key will + be checked against available keys from pacman.conf + +value:: + Specifies the value which will be set against the key + + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent', defaults to 'present' + +file:: + Specifies the filename. + + The managed file will be named like 'plain_file_filename' + + If supplied the key will not be checked. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Manage options section in pacman.conf +__pacman_conf options_Architecture --section options --key Architecture --value auto + +# Add new repository +__pacman_conf localrepo_Server --section localrepo --key Server --value "file:///var/cache/pacman/pkg" + +# Add mirror to a mirrorlist +__pacman_conf customlist_Server --file customlist --section customlist --key Server\ + --value "file:///var/cache/pacman/pkg" + +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- grep(1) + + +COPYING +------- +Copyright \(C) 2015 Dominique Roux. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__pacman_conf/manifest b/cdist/conf/type/__pacman_conf/manifest new file mode 100644 index 00000000..f817b2ca --- /dev/null +++ b/cdist/conf/type/__pacman_conf/manifest @@ -0,0 +1,111 @@ +#get params +section=$(cat "$__object/parameter/section") +key=$(cat "$__object/parameter/key") +value=$(cat "$__object/parameter/value") +file=$(cat "$__object/parameter/file" 2>/dev/null || echo "") +state=$(cat "$__object/parameter/state" 2>/dev/null || echo "present" ) + +#path variable default /etc/pacman.d +sec_path="/etc/pacman.d" + +#allowed keys (from man pacman.conf) +allowed_option_keys=( "RootDir" "DBPath" "CacheDir" "GPGDir" "LogFile" "HoldPkg" "IgnorePkg" "IgnoreGroup" "Include" "Architecture" "XferCommand" "NoUpgrade" "NoExtract" "CleanMethod" "SigLevel" "LocalFileSigLevel" "RemoteFileSigLevel" ) +boolean_option_keys=( "UseSyslog" "Color" "UseDelta" "TotalDownload" "CheckSpace" "VerbosePkgLists" ) +allowed_repo_keys=( "Include" "Server" "SigLevel" "Usage" ) + +#set global variables +MATH=1 + +#function for check if array contain string +contains_element() { + + MATCH=1 + + local passed_array + passed_array=(`echo "$2"`) + + for e in "${passed_array[@]}"; do + if [ "${e}" == "${1}" ]; then + MATCH=0 + return 0 + fi + done + MATCH=1 +} + +if [ "${file}" != "" ]; then + __file "${sec_path}/plain_file_${file}"\ + --state exists --mode 666 + + if [ "${state}" == "present" ]; then + + require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\ + --file ${sec_path}/plain_file_${file} --key ${key} --value ${value} --delimiter ' = ' + + exit 0 + + elif [ "${state}" == "absent" ]; then + require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\ + --state absent + + else + echo "ERROR: State not found" >&2 + fi +fi + +if [ "${section}" == "options" ]; then + + __file "${sec_path}/${section}"\ + --state exists --mode 666 --source - << eof +[${section}] +eof + #check if key is valid + #check for boolean value + contains_element "${key}" "$(echo ${boolean_option_keys[@]})" + + if [ "${MATCH}" -eq 0 ]; then + if [ "${value}" == "on" ]; then + require="__file/${sec_path}/${section}" __line ${key}_${value}\ + --file ${sec_path}/${section} --line ${key} + elif [ "${value}" == "off" ]; then + require="__file/${sec_path}/${section}" __line ${key}_${value}\ + --file ${sec_path}/${section} --line ${key} --state absent + fi + + else + contains_element "${key}" "$(echo ${allowed_option_keys[@]})" + + if [ "${MATCH}" -eq 0 ]; then + require="__file/${sec_path}/${section}" __key_value ${section}_${key}\ + --file ${sec_path}/${section} --key ${key} --value ${value} --delimiter ' = ' + else + echo "Key is not valid. Have a look at man pacman.conf" >&2 + fi + fi + +else + __file "${sec_path}/repo_${section}"\ + --state exists --mode 666 --source - << eof +[${section}] +eof + if [ "${state}" == "present" ]; then + + #check if key is valid + contains_element "${key}" "$(echo ${allowed_repo_keys[@]})" + if [ ${MATCH} -eq 1 ]; then + exit + fi + + require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\ + --file ${sec_path}/repo_${section} --key ${key} --value ${value} --delimiter ' = ' + + elif [ "${state}" == "absent" ]; then + + require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\ + --state absent + + else + echo "ERROR: State not found" >&2 + fi + +fi diff --git a/cdist/conf/type/__pacman_conf/parameter/optional b/cdist/conf/type/__pacman_conf/parameter/optional new file mode 100644 index 00000000..5d52aa2e --- /dev/null +++ b/cdist/conf/type/__pacman_conf/parameter/optional @@ -0,0 +1,2 @@ +file +state diff --git a/cdist/conf/type/__pacman_conf/parameter/required b/cdist/conf/type/__pacman_conf/parameter/required new file mode 100644 index 00000000..2f9d59e0 --- /dev/null +++ b/cdist/conf/type/__pacman_conf/parameter/required @@ -0,0 +1,3 @@ +section +key +value diff --git a/cdist/conf/type/__pacman_integrate/files/mirrorlist b/cdist/conf/type/__pacman_integrate/files/mirrorlist new file mode 100644 index 00000000..a378fb50 --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/files/mirrorlist @@ -0,0 +1,344 @@ +## +## Arch Linux repository mirrorlist +## Generated on 2015-03-15 +## + +## Worldwide +#Server = http://mirror.rackspace.com/archlinux/$repo/os/$arch + +## Australia +#Server = http://mirror.aarnet.edu.au/pub/archlinux/$repo/os/$arch +#Server = http://archlinux.mirror.digitalpacific.com.au/$repo/os/$arch +#Server = http://ftp.iinet.net.au/pub/archlinux/$repo/os/$arch +#Server = http://mirror.internode.on.net/pub/archlinux/$repo/os/$arch +#Server = http://mirror.rackcentral.com.au/archlinux/$repo/os/$arch +#Server = http://ftp.swin.edu.au/archlinux/$repo/os/$arch +#Server = http://archlinux.mirror.uber.com.au/$repo/os/$arch + +## Austria +#Server = http://mirror.easyname.at/archlinux/$repo/os/$arch +#Server = http://mirror1.htu.tugraz.at/archlinux/$repo/os/$arch + +## Bangladesh +#Server = http://mirrors.ispros.com.bd/archlinux/$repo/os/$arch + +## Belarus +#Server = http://ftp.byfly.by/pub/archlinux/$repo/os/$arch +#Server = http://mirror.datacenter.by/pub/archlinux/$repo/os/$arch + +## Belgium +#Server = http://archlinux.cu.be/$repo/os/$arch +#Server = http://archlinux.mirror.kangaroot.net/$repo/os/$arch + +## Brazil +#Server = http://archlinux.c3sl.ufpr.br/$repo/os/$arch +#Server = http://www.las.ic.unicamp.br/pub/archlinux/$repo/os/$arch +#Server = http://pet.inf.ufsc.br/mirrors/archlinux/$repo/os/$arch + +## Bulgaria +#Server = http://mirror.telepoint.bg/archlinux/$repo/os/$arch + +## Canada +#Server = http://archlinux.dropswitch.net/archlinux/$repo/os/$arch +#Server = http://mirror.clibre.uqam.ca/archlinux/$repo/os/$arch +#Server = http://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/$arch +#Server = http://mirror.its.dal.ca/archlinux/$repo/os/$arch +#Server = http://archlinux.mirror.rafal.ca/$repo/os/$arch +#Server = http://archlinux.mirror.vexxhost.com/$repo/os/$arch + +## Chile +#Server = http://mirror.archlinux.cl/$repo/os/$arch + +## China +#Server = http://mirrors.163.com/archlinux/$repo/os/$arch +#Server = http://mirror.bjtu.edu.cn/archlinux/$repo/os/$arch +#Server = http://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch +#Server = http://mirrors.hust.edu.cn/archlinux/$repo/os/$arch +#Server = http://mirrors.hustunique.com/archlinux/$repo/os/$arch +#Server = http://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch +#Server = http://run.hit.edu.cn/archlinux/$repo/os/$arch +#Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch +#Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch +#Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch +#Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch + +## Colombia +#Server = http://mirror.edatel.net.co/archlinux/$repo/os/$arch +#Server = http://www.laqee.unal.edu.co/archlinux/$repo/os/$arch + +## Croatia +#Server = http://archlinux.iskon.hr/$repo/os/$arch + +## Czech Republic +#Server = http://archlinux.mirror.dkm.cz/pub/archlinux/$repo/os/$arch +#Server = http://gluttony.sin.cvut.cz/arch/$repo/os/$arch +#Server = http://mirror.oss.maxcdn.com/archlinux/$repo/os/$arch +#Server = http://mirrors.nic.cz/archlinux/$repo/os/$arch +#Server = http://mirror.vpsfree.cz/archlinux/$repo/os/$arch + +## Denmark +#Server = http://mirrors.dotsrc.org/archlinux/$repo/os/$arch +#Server = http://mirror.one.com/archlinux/$repo/os/$arch + +## Ecuador +#Server = http://mirror.cedia.org.ec/archlinux/$repo/os/$arch +#Server = http://mirror.espoch.edu.ec/archlinux/$repo/os/$arch +#Server = http://mirror.uta.edu.ec/archlinux/$repo/os/$arch + +## Estonia +#Server = http://ftp.eenet.ee/pub/archlinux/$repo/os/$arch + +## France +#Server = http://archlinux.aubrac-medical.fr/$repo/os/$arch +#Server = http://mirror.archlinux.ikoula.com/archlinux/$repo/os/$arch +#Server = http://archlinux.vi-di.fr/$repo/os/$arch +#Server = http://mir.art-software.fr/arch/$repo/os/$arch +#Server = http://fooo.biz/archlinux/$repo/os/$arch +#Server = https://fooo.biz/archlinux/$repo/os/$arch +#Server = http://mirror.lastmikoi.net/archlinux/$repo/os/$arch +#Server = http://mirror.lightcone.eu/archlinux/$repo/os/$arch +#Server = http://archlinux.mailtunnel.eu/$repo/os/$arch +#Server = https://www.mailtunnel.eu/archlinux/$repo/os/$arch +#Server = http://mir.archlinux.fr/$repo/os/$arch +#Server = http://arch.nimukaito.net/$repo/os/$arch +#Server = http://archlinux.mirrors.ovh.net/archlinux/$repo/os/$arch +#Server = http://archlinux.mirror.pkern.at/$repo/os/$arch +#Server = https://archlinux.mirror.pkern.at/$repo/os/$arch +#Server = http://archlinux.polymorf.fr/$repo/os/$arch +#Server = http://arch.static.lu/$repo/os/$arch +#Server = https://arch.static.lu/$repo/os/$arch +#Server = http://arch.tamcore.eu/$repo/os/$arch +#Server = http://mirror.tyborek.pl/arch/$repo/os/$arch +#Server = http://ftp.u-strasbg.fr/linux/distributions/archlinux/$repo/os/$arch +#Server = http://arch.yourlabs.org/$repo/os/$arch + +## Germany +#Server = http://mirror.23media.de/archlinux/$repo/os/$arch +#Server = http://archlinux.limun.org/$repo/os/$arch +#Server = https://archlinux.limun.org/$repo/os/$arch +#Server = http://artfiles.org/archlinux.org/$repo/os/$arch +#Server = http://ftp.fau.de/archlinux/$repo/os/$arch +#Server = https://ftp.fau.de/archlinux/$repo/os/$arch +#Server = http://mirror.flipez.de/archlinux/$repo/os/$arch +#Server = http://mirror.fluxent.de/archlinux/$repo/os/$arch +#Server = http://mirror.gnomus.de/$repo/os/$arch +#Server = http://arch.packages.gnp-tec.net/$repo/os/$arch +#Server = http://ftp5.gwdg.de/pub/linux/archlinux/$repo/os/$arch +#Server = http://mirror.hactar.bz/$repo/os/$arch +#Server = http://ftp.hawo.stw.uni-erlangen.de/archlinux/$repo/os/$arch +#Server = http://ftp.hosteurope.de/mirror/ftp.archlinux.org/$repo/os/$arch +#Server = http://ftp-stud.hs-esslingen.de/pub/Mirrors/archlinux/$repo/os/$arch +#Server = http://mirror.js-webcoding.de/pub/archlinux/$repo/os/$arch +#Server = http://mirror.k42.ch/archlinux/$repo/os/$arch +#Server = http://mirror.de.leaseweb.net/archlinux/$repo/os/$arch +#Server = http://mirror.metalgamer.eu/archlinux/$repo/os/$arch +#Server = http://mirror.michael-eckert.net/archlinux/$repo/os/$arch +#Server = http://archlinux.my-universe.com/$repo/os/$arch +#Server = https://archlinux.my-universe.com/$repo/os/$arch +#Server = http://mirrors.n-ix.net/archlinux/$repo/os/$arch +#Server = http://mirror.netcologne.de/archlinux/$repo/os/$arch +#Server = http://mirrors.niyawe.de/archlinux/$repo/os/$arch +#Server = http://ftp.halifax.rwth-aachen.de/archlinux/$repo/os/$arch +#Server = http://linux.rz.rub.de/archlinux/$repo/os/$arch +#Server = http://mirror.selfnet.de/archlinux/$repo/os/$arch +#Server = http://ftp.spline.inf.fu-berlin.de/mirrors/archlinux/$repo/os/$arch +#Server = http://ftp.tu-chemnitz.de/pub/linux/archlinux/$repo/os/$arch +#Server = http://ftp.tuxdroid.org/archlinux/$repo/os/$arch +#Server = http://ftp.uni-bayreuth.de/linux/archlinux/$repo/os/$arch +#Server = http://ftp.uni-hannover.de/archlinux/$repo/os/$arch +#Server = http://ftp.uni-kl.de/pub/linux/archlinux/$repo/os/$arch +#Server = http://mirror.united-gameserver.de/archlinux/$repo/os/$arch + +## Greece +#Server = http://ftp.cc.uoc.gr/mirrors/linux/archlinux/$repo/os/$arch +#Server = http://foss.aueb.gr/mirrors/linux/archlinux/$repo/os/$arch +#Server = https://foss.aueb.gr/mirrors/linux/archlinux/$repo/os/$arch +#Server = http://mirrors.myaegean.gr/linux/archlinux/$repo/os/$arch +#Server = http://ftp.ntua.gr/pub/linux/archlinux/$repo/os/$arch +#Server = http://ftp.otenet.gr/linux/archlinux/$repo/os/$arch + +## Hungary +#Server = http://ftp.mfa.kfki.hu/pub/mirrors/ftp.archlinux.org/$repo/os/$arch + +## Iceland +#Server = http://mirror.system.is/arch/$repo/os/$arch +#Server = https://mirror.system.is/arch/$repo/os/$arch + +## India +#Server = http://mirror.cse.iitk.ac.in/archlinux/$repo/os/$arch +#Server = http://ftp.iitm.ac.in/archlinux/$repo/os/$arch + +## Indonesia +#Server = http://mirror.kavalinux.com/archlinux/$repo/os/$arch +#Server = http://mirror.poliwangi.ac.id/archlinux/$repo/os/$arch +#Server = http://suro.ubaya.ac.id/archlinux/$repo/os/$arch + +## Iran +#Server = http://mirror.yazd.ac.ir/arch/$repo/os/$arch + +## Ireland +#Server = http://ftp.heanet.ie/mirrors/ftp.archlinux.org/$repo/os/$arch + +## Israel +#Server = http://mirror.isoc.org.il/pub/archlinux/$repo/os/$arch + +## Italy +#Server = http://archlinux.openlabto.org/archlinux/$repo/os/$arch +#Server = http://archlinux.beccacervello.it/archlinux/$repo/os/$arch +#Server = http://mirrors.prometeus.net/archlinux/$repo/os/$arch + +## Japan +#Server = http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/$repo/os/$arch +#Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch + +## Kazakhstan +#Server = http://mirror.neolabs.kz/archlinux/$repo/os/$arch + +## Latvia +#Server = http://archlinux.koyanet.lv/archlinux/$repo/os/$arch + +## Lithuania +#Server = http://archlinux.akmc.lt/$repo/os/$arch +#Server = http://atviras.lt/veidrodziai/archlinux/$repo/os/$arch + +## Luxembourg +#Server = http://archlinux.mirror.root.lu/$repo/os/$arch + +## Macedonia +#Server = http://arch.softver.org.mk/archlinux/$repo/os/$arch +#Server = http://mirror.t-home.mk/archlinux/$repo/os/$arch + +## Netherlands +#Server = http://arch.apt-get.eu/$repo/os/$arch +#Server = http://mirror.i3d.net/pub/archlinux/$repo/os/$arch +#Server = https://mirror.i3d.net/pub/archlinux/$repo/os/$arch +#Server = http://mirror.nl.leaseweb.net/archlinux/$repo/os/$arch +#Server = http://ftp.nluug.nl/os/Linux/distr/archlinux/$repo/os/$arch +#Server = http://ftp.snt.utwente.nl/pub/os/linux/archlinux/$repo/os/$arch + +## New Caledonia +#Server = http://mirror.lagoon.nc/pub/archlinux/$repo/os/$arch +#Server = http://archlinux.nautile.nc/archlinux/$repo/os/$arch + +## New Zealand +#Server = http://mirror.xnet.co.nz/pub/archlinux/$repo/os/$arch + +## Norway +#Server = http://mirror.archlinux.no/$repo/os/$arch +#Server = http://archlinux.uib.no/$repo/os/$arch +#Server = http://archlinux.neuf.no/$repo/os/$arch + +## Philippines +#Server = http://mirror.pregi.net/pub/Linux/archlinux/$repo/os/$arch + +## Poland +#Server = http://mirror.chmuri.net/archmirror/$repo/os/$arch +#Server = http://arch.midov.pl/arch/$repo/os/$arch +#Server = http://piotrkosoft.net/pub/mirrors/ftp.archlinux.org/$repo/os/$arch +#Server = http://ftp.vectranet.pl/archlinux/$repo/os/$arch + +## Portugal +#Server = http://archlinux.dcc.fc.up.pt/$repo/os/$arch +#Server = http://ftp.rnl.tecnico.ulisboa.pt/pub/archlinux/$repo/os/$arch + +## Romania +#Server = http://mirror.archlinux.ro/archlinux/$repo/os/$arch +#Server = http://archlinux.mirrors.linux.ro/$repo/os/$arch + +## Russia +#Server = http://mirror.rol.ru/archlinux/$repo/os/$arch +#Server = http://mirror.yandex.ru/archlinux/$repo/os/$arch + +## Serbia +#Server = http://mirror.pmf.kg.ac.rs/archlinux/$repo/os/$arch + +## Singapore +#Server = http://download.nus.edu.sg/mirror/arch/$repo/os/$arch +#Server = http://mirror.nus.edu.sg/archlinux/$repo/os/$arch + +## Slovakia +#Server = http://mirror.lnx.sk/pub/linux/archlinux/$repo/os/$arch +#Server = http://tux.rainside.sk/archlinux/$repo/os/$arch + +## South Africa +#Server = http://ftp.wa.co.za/pub/archlinux/$repo/os/$arch + +## South Korea +#Server = http://ftp.kaist.ac.kr/ArchLinux/$repo/os/$arch +#Server = http://mirror.premi.st/archlinux/$repo/os/$arch + +## Spain +#Server = http://osl.ugr.es/archlinux/$repo/os/$arch +#Server = http://sunsite.rediris.es/mirror/archlinux/$repo/os/$arch + +## Sweden +#Server = http://ftp.df.lth.se/pub/archlinux/$repo/os/$arch +#Server = http://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch +#Server = https://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch +#Server = http://ftp.myrveln.se/pub/linux/archlinux/$repo/os/$arch +#Server = http://ftp.portlane.com/pub/os/linux/archlinux/$repo/os/$arch + +## Switzerland +#Server = http://archlinux.puzzle.ch/$repo/os/$arch + +## Taiwan +#Server = http://archlinux.cs.nctu.edu.tw/$repo/os/$arch +#Server = http://shadow.ind.ntou.edu.tw/archlinux/$repo/os/$arch +#Server = http://ftp.tku.edu.tw/Linux/ArchLinux/$repo/os/$arch +#Server = http://ftp.yzu.edu.tw/Linux/archlinux/$repo/os/$arch + +## Turkey +#Server = http://ftp.linux.org.tr/archlinux/$repo/os/$arch + +## Ukraine +#Server = http://mirrors.nix.org.ua/linux/archlinux/$repo/os/$arch + +## United Kingdom +#Server = http://mirror.bytemark.co.uk/archlinux/$repo/os/$arch +#Server = http://mirror.cinosure.com/archlinux/$repo/os/$arch +#Server = http://mirrors.manchester.m247.com/arch-linux/$repo/os/$arch +#Server = http://www.mirrorservice.org/sites/ftp.archlinux.org/$repo/os/$arch +#Server = http://arch.serverspace.co.uk/arch/$repo/os/$arch +#Server = http://archlinux.mirrors.uk2.net/$repo/os/$arch + +## United States +#Server = http://mirrors.abscission.net/archlinux/$repo/os/$arch +#Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch +#Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch +#Server = http://mirrors.aggregate.org/archlinux/$repo/os/$arch +#Server = http://archlinux.surlyjake.com/archlinux/$repo/os/$arch +#Server = http://mirrors.cat.pdx.edu/archlinux/$repo/os/$arch +#Server = http://mirror.cc.columbia.edu/pub/linux/archlinux/$repo/os/$arch +#Server = http://mirrors.cdndepo.com/archlinux/$repo/os/$arch +#Server = https://mirrors.cdndepo.com/archlinux/$repo/os/$arch +#Server = http://mirrors.cecsresearch.org/archlinux/$repo/os/$arch +#Server = http://cosmos.cites.illinois.edu/pub/archlinux/$repo/os/$arch +#Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch +#Server = http://mirror.es.its.nyu.edu/archlinux/$repo/os/$arch +#Server = http://mirrors.gigenet.com/archlinux/$repo/os/$arch +#Server = http://mirror.grig.io/archlinux/$repo/os/$arch +#Server = http://www.gtlib.gatech.edu/pub/archlinux/$repo/os/$arch +#Server = http://mirror.ancl.hawaii.edu/linux/archlinux/$repo/os/$arch +#Server = http://mirror.jmu.edu/pub/archlinux/$repo/os/$arch +#Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch +#Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch +#Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch +#Server = http://mirrors.liquidweb.com/archlinux/$repo/os/$arch +#Server = http://arch.localmsp.org/arch/$repo/os/$arch +#Server = https://arch.localmsp.org/arch/$repo/os/$arch +#Server = http://lug.mtu.edu/archlinux/$repo/os/$arch +#Server = http://mirror.metrocast.net/archlinux/$repo/os/$arch +#Server = http://mirror.nexcess.net/archlinux/$repo/os/$arch +#Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch +#Server = http://archlinux.pallissard.net/archlinux/$repo/os/$arch +#Server = http://mirror.rit.edu/archlinux/$repo/os/$arch +#Server = http://mirrors.rutgers.edu/archlinux/$repo/os/$arch +#Server = http://mirror.umd.edu/archlinux/$repo/os/$arch +#Server = http://mirror.vtti.vt.edu/archlinux/$repo/os/$arch +#Server = http://mirrors.xmission.com/archlinux/$repo/os/$arch +#Server = http://mirror.yellowfiber.net/archlinux/$repo/os/$arch + +## Vietnam +#Server = http://f.archlinuxvn.org/archlinux/$repo/os/$arch +#Server = http://mirror-fpt-telecom.fpt.net/archlinux/$repo/os/$arch + diff --git a/cdist/conf/type/__pacman_integrate/files/options b/cdist/conf/type/__pacman_integrate/files/options new file mode 100644 index 00000000..68273e49 --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/files/options @@ -0,0 +1,6 @@ +[options] +HoldPkg = pacman glibc +Architecture = auto +CheckSpace +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional diff --git a/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist b/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist new file mode 100644 index 00000000..b0d116bc --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist @@ -0,0 +1,6 @@ +# +# cdist managed - do not change +# +Include = /etc/pacman.d/options +Include = /etc/pacman.d/repo_* +Include = /etc/plain_file_* diff --git a/cdist/conf/type/__pacman_integrate/files/pacman.conf.pacman b/cdist/conf/type/__pacman_integrate/files/pacman.conf.pacman new file mode 100644 index 00000000..f43fe397 --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/files/pacman.conf.pacman @@ -0,0 +1,99 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -C - -f %u > %o +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +#UseDelta = 0.7 +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +#Color +#TotalDownload +CheckSpace +#VerbosePkgLists + +# By default, pacman accepts packages signed by keys that its local keyring +# trusts (see pacman-key and its man page), as well as unsigned packages. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +#[testing] +#Include = /etc/pacman.d/mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +#[community-testing] +#Include = /etc/pacman.d/mirrorlist + +[community] +Include = /etc/pacman.d/mirrorlist + +# If you want to run 32 bit applications on your x86_64 system, +# enable the multilib repositories as required here. + +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist + +#[multilib] +#Include = /etc/pacman.d/mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs diff --git a/cdist/conf/type/__pacman_integrate/man.text b/cdist/conf/type/__pacman_integrate/man.text new file mode 100644 index 00000000..d2cf88c1 --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/man.text @@ -0,0 +1,48 @@ +cdist-type__pacman_integrate(7) +=================== +Dominique Roux + + +NAME +---- +cdist-type__pacman_integrate - Integrate default pacman.conf to cdist conform and vice versa + + +DESCRIPTION +----------- +The type allows you to convert the default pacman.conf to a cdist conform one and vice versa + + +REQUIRED PARAMETERS +------------------- +None. + +OPTIONAL PARAMETERS +------------------- +state:: + 'present' or 'absent', defaults to 'present' + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Convert normal to cdist conform +__pacman_integrate convert + +# Convert cdist conform to normal +__pacman_integrate convert --state absent + +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- grep(1) + + +COPYING +------- +Copyright \(C) 2015 Dominique Roux. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__pacman_integrate/manifest b/cdist/conf/type/__pacman_integrate/manifest new file mode 100644 index 00000000..9f0c69c7 --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/manifest @@ -0,0 +1,46 @@ +state=$(cat $__object/parameter/state 2>/dev/null || echo "present" ) + +if [ "${state}" == "present" ]; then + #__rsync /etc/pacman.conf\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.conf\ + --owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist + + #__rsync /etc/pacman.d/options\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/options\ + --owner root --group root --mode 644 --source $__type/files/options + + #__file /etc/pacman.d/repo_empty_placeholder\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/repo_empty_placeholder\ + --owner root --group root --mode 644 + + #__file /etc/pacman.d/plain_file_empty_placeholder\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/plain_file_empty_placeholder\ + --owner root --group root --mode 644 + +elif [ "${state}" == "absent" ]; then + + #__rsync /etc/pacman.conf\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.conf\ + --owner root --group root --mode 644 --source $__type/files/pacman.conf.pacman + + #__rsync /etc/pacman.d/mirrorlist\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/mirrorlist\ + --owner root --group root --mode 644 --source $__type/files/mirrorlist + + #__rsync /etc/pacman.d/options\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/options\ + --state absent + + #__file /etc/pacman.d/repo_empty_placeholder\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/repo_empty_placeholder\ + --state absent + + #__file /etc/pacman.d/plain_file_empty_placeholder\ + __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/plain_file_empty_placeholder\ + --state absent + +else + + echo "ERROR: State not found" >&2 + +fi diff --git a/cdist/conf/type/__pacman_integrate/parameter/optional b/cdist/conf/type/__pacman_integrate/parameter/optional new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/parameter/optional @@ -0,0 +1 @@ +state From 1690c9d8ff0919fc3c0afec5fe09b9b3d20bc380 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Tue, 12 May 2015 19:12:49 +0200 Subject: [PATCH 2/6] Bugfixes: -Added GPLv3 header -Set correct '=' in man.text -Now uses default values cdist-like -Replace arrays with plain variables -Rewrote the error message --- cdist/conf/type/__pacman_conf/man.text | 2 +- cdist/conf/type/__pacman_conf/manifest | 65 ++++++++++++------- .../type/__pacman_conf/parameter/default/file | 2 + .../__pacman_conf/parameter/default/state | 1 + cdist/conf/type/__pacman_integrate/man.text | 2 +- cdist/conf/type/__pacman_integrate/manifest | 53 +++++++++------ .../parameter/default/state | 1 + 7 files changed, 82 insertions(+), 44 deletions(-) create mode 100644 cdist/conf/type/__pacman_conf/parameter/default/file create mode 100644 cdist/conf/type/__pacman_conf/parameter/default/state create mode 100644 cdist/conf/type/__pacman_integrate/parameter/default/state diff --git a/cdist/conf/type/__pacman_conf/man.text b/cdist/conf/type/__pacman_conf/man.text index b4905111..9762837f 100644 --- a/cdist/conf/type/__pacman_conf/man.text +++ b/cdist/conf/type/__pacman_conf/man.text @@ -1,5 +1,5 @@ cdist-type__pacman_conf(7) -=================== +========================== Dominique Roux diff --git a/cdist/conf/type/__pacman_conf/manifest b/cdist/conf/type/__pacman_conf/manifest index f817b2ca..591218b8 100644 --- a/cdist/conf/type/__pacman_conf/manifest +++ b/cdist/conf/type/__pacman_conf/manifest @@ -1,36 +1,57 @@ +#!/bin/sh +# +# 2015 Dominique Roux (dominique.roux4 at gmail.com) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist 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. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + #get params section=$(cat "$__object/parameter/section") key=$(cat "$__object/parameter/key") value=$(cat "$__object/parameter/value") -file=$(cat "$__object/parameter/file" 2>/dev/null || echo "") -state=$(cat "$__object/parameter/state" 2>/dev/null || echo "present" ) +file=$(cat "$__object/parameter/file" 2>/dev/null) +state=$(cat "$__object/parameter/state" 2>/dev/null) #path variable default /etc/pacman.d sec_path="/etc/pacman.d" #allowed keys (from man pacman.conf) -allowed_option_keys=( "RootDir" "DBPath" "CacheDir" "GPGDir" "LogFile" "HoldPkg" "IgnorePkg" "IgnoreGroup" "Include" "Architecture" "XferCommand" "NoUpgrade" "NoExtract" "CleanMethod" "SigLevel" "LocalFileSigLevel" "RemoteFileSigLevel" ) -boolean_option_keys=( "UseSyslog" "Color" "UseDelta" "TotalDownload" "CheckSpace" "VerbosePkgLists" ) -allowed_repo_keys=( "Include" "Server" "SigLevel" "Usage" ) +allowed_option_keys="RootDir DBPath CacheDir GPGDir LogFile HoldPkg IgnorePkg IgnoreGroup Include Architecture XferCommand NoUpgrade NoExtract CleanMethod SigLevel LocalFileSigLevel RemoteFileSigLevel" +boolean_option_keys="UseSyslog Color UseDelta TotalDownload CheckSpace VerbosePkgLists" +allowed_repo_keys="Include Server SigLevel Usage" #set global variables -MATH=1 +MATCH=0 #function for check if array contain string contains_element() { - MATCH=1 + MATCH=0 - local passed_array - passed_array=(`echo "$2"`) + target=$1 + keys="${@:2}" - for e in "${passed_array[@]}"; do - if [ "${e}" == "${1}" ]; then - MATCH=0 + + for key in "${keys}"; do + if [ "${key}" == "${target}" ]; then + MATCH=1 return 0 fi done - MATCH=1 + MATCH=0 } if [ "${file}" != "" ]; then @@ -49,7 +70,7 @@ if [ "${file}" != "" ]; then --state absent else - echo "ERROR: State not found" >&2 + echo "ERROR: Unknown state: ${state}" >&2 fi fi @@ -61,9 +82,9 @@ if [ "${section}" == "options" ]; then eof #check if key is valid #check for boolean value - contains_element "${key}" "$(echo ${boolean_option_keys[@]})" + contains_element "${key}" "${boolean_option_keys}" - if [ "${MATCH}" -eq 0 ]; then + if [ "${MATCH}" -eq 1 ]; then if [ "${value}" == "on" ]; then require="__file/${sec_path}/${section}" __line ${key}_${value}\ --file ${sec_path}/${section} --line ${key} @@ -73,13 +94,13 @@ eof fi else - contains_element "${key}" "$(echo ${allowed_option_keys[@]})" + contains_element "${key}" "${allowed_option_keys}" - if [ "${MATCH}" -eq 0 ]; then + if [ "${MATCH}" -eq 1 ]; then require="__file/${sec_path}/${section}" __key_value ${section}_${key}\ --file ${sec_path}/${section} --key ${key} --value ${value} --delimiter ' = ' else - echo "Key is not valid. Have a look at man pacman.conf" >&2 + echo "Key: ${key} is not valid. Have a look at man pacman.conf" >&2 fi fi @@ -91,8 +112,8 @@ eof if [ "${state}" == "present" ]; then #check if key is valid - contains_element "${key}" "$(echo ${allowed_repo_keys[@]})" - if [ ${MATCH} -eq 1 ]; then + contains_element "${key}" "${allowed_repo_keys}" + if [ ${MATCH} -eq 0 ]; then exit fi @@ -105,7 +126,7 @@ eof --state absent else - echo "ERROR: State not found" >&2 + echo "ERROR: Unknown state: ${state}" >&2 fi fi diff --git a/cdist/conf/type/__pacman_conf/parameter/default/file b/cdist/conf/type/__pacman_conf/parameter/default/file new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/cdist/conf/type/__pacman_conf/parameter/default/file @@ -0,0 +1,2 @@ + + diff --git a/cdist/conf/type/__pacman_conf/parameter/default/state b/cdist/conf/type/__pacman_conf/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__pacman_conf/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__pacman_integrate/man.text b/cdist/conf/type/__pacman_integrate/man.text index d2cf88c1..f65e30ce 100644 --- a/cdist/conf/type/__pacman_integrate/man.text +++ b/cdist/conf/type/__pacman_integrate/man.text @@ -1,5 +1,5 @@ cdist-type__pacman_integrate(7) -=================== +=============================== Dominique Roux diff --git a/cdist/conf/type/__pacman_integrate/manifest b/cdist/conf/type/__pacman_integrate/manifest index 9f0c69c7..5f398c19 100644 --- a/cdist/conf/type/__pacman_integrate/manifest +++ b/cdist/conf/type/__pacman_integrate/manifest @@ -1,46 +1,59 @@ -state=$(cat $__object/parameter/state 2>/dev/null || echo "present" ) +#!/bin/sh +# +# 2015 Dominique Roux (dominique.roux4 at gmail.com +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist 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. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +state=$(cat $__object/parameter/state 2>/dev/null) + +path="/etc/" if [ "${state}" == "present" ]; then - #__rsync /etc/pacman.conf\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.conf\ + __file /etc/pacman.conf\ --owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist - #__rsync /etc/pacman.d/options\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/options\ + __file /etc/pacman.d/options\ --owner root --group root --mode 644 --source $__type/files/options - #__file /etc/pacman.d/repo_empty_placeholder\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/repo_empty_placeholder\ + __file /etc/pacman.d/repo_empty_placeholder\ --owner root --group root --mode 644 - #__file /etc/pacman.d/plain_file_empty_placeholder\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/plain_file_empty_placeholder\ + __file /etc/pacman.d/plain_file_empty_placeholder\ --owner root --group root --mode 644 elif [ "${state}" == "absent" ]; then - #__rsync /etc/pacman.conf\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.conf\ + __file /etc/pacman.conf\ --owner root --group root --mode 644 --source $__type/files/pacman.conf.pacman - #__rsync /etc/pacman.d/mirrorlist\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/mirrorlist\ + __file /etc/pacman.d/mirrorlist\ --owner root --group root --mode 644 --source $__type/files/mirrorlist - #__rsync /etc/pacman.d/options\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/options\ + __file /etc/pacman.d/options\ --state absent - #__file /etc/pacman.d/repo_empty_placeholder\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/repo_empty_placeholder\ + __file /etc/pacman.d/repo_empty_placeholder\ --state absent - #__file /etc/pacman.d/plain_file_empty_placeholder\ - __file /home/rouxdo/Documents/Work/cdist-dev/pacman.d/plain_file_empty_placeholder\ + __file /etc/pacman.d/plain_file_empty_placeholder\ --state absent else - echo "ERROR: State not found" >&2 + echo "ERROR: Unknown state: ${state}" >&2 fi diff --git a/cdist/conf/type/__pacman_integrate/parameter/default/state b/cdist/conf/type/__pacman_integrate/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__pacman_integrate/parameter/default/state @@ -0,0 +1 @@ +present From f0fd3e460812dc7ceb87e2b81de7274d10ef8527 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Wed, 13 May 2015 12:55:18 +0200 Subject: [PATCH 3/6] small bugfixes --- cdist/conf/type/__pacman_conf/manifest | 2 +- cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__pacman_conf/manifest b/cdist/conf/type/__pacman_conf/manifest index 591218b8..4e48758b 100644 --- a/cdist/conf/type/__pacman_conf/manifest +++ b/cdist/conf/type/__pacman_conf/manifest @@ -45,7 +45,7 @@ contains_element() { keys="${@:2}" - for key in "${keys}"; do + for key in ${keys}; do if [ "${key}" == "${target}" ]; then MATCH=1 return 0 diff --git a/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist b/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist index b0d116bc..88e6e623 100644 --- a/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist +++ b/cdist/conf/type/__pacman_integrate/files/pacman.conf.cdist @@ -3,4 +3,4 @@ # Include = /etc/pacman.d/options Include = /etc/pacman.d/repo_* -Include = /etc/plain_file_* +Include = /etc/pacman.d/plain_file_* From 1ad4125a3bc703727127ecb2ee8843d6f62bdf50 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Wed, 13 May 2015 13:12:25 +0200 Subject: [PATCH 4/6] Add exit if file is specified --- cdist/conf/type/__pacman_conf/manifest | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__pacman_conf/manifest b/cdist/conf/type/__pacman_conf/manifest index 4e48758b..7074bb1a 100644 --- a/cdist/conf/type/__pacman_conf/manifest +++ b/cdist/conf/type/__pacman_conf/manifest @@ -71,6 +71,7 @@ if [ "${file}" != "" ]; then else echo "ERROR: Unknown state: ${state}" >&2 + exit 0 fi fi From 672aa13316b5ba3df4ecb4ed14aa210ea26a33a7 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Wed, 13 May 2015 13:28:48 +0200 Subject: [PATCH 5/6] Second forgotten exit --- cdist/conf/type/__pacman_conf/manifest | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__pacman_conf/manifest b/cdist/conf/type/__pacman_conf/manifest index 7074bb1a..726074d4 100644 --- a/cdist/conf/type/__pacman_conf/manifest +++ b/cdist/conf/type/__pacman_conf/manifest @@ -68,6 +68,7 @@ if [ "${file}" != "" ]; then elif [ "${state}" == "absent" ]; then require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\ --state absent + exit 0 else echo "ERROR: Unknown state: ${state}" >&2 From 62e1ecdd0817c98bf349a9143ab98b3c8bdfaee1 Mon Sep 17 00:00:00 2001 From: Dominique Roux Date: Tue, 19 May 2015 08:18:33 +0200 Subject: [PATCH 6/6] changed if statement: from if [ != ]; to if [ ]; --- cdist/conf/type/__pacman_conf/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__pacman_conf/manifest b/cdist/conf/type/__pacman_conf/manifest index 726074d4..19e232a7 100644 --- a/cdist/conf/type/__pacman_conf/manifest +++ b/cdist/conf/type/__pacman_conf/manifest @@ -54,7 +54,7 @@ contains_element() { MATCH=0 } -if [ "${file}" != "" ]; then +if [ "${file}" ]; then __file "${sec_path}/plain_file_${file}"\ --state exists --mode 666