Merge remote-tracking branch 'dominique/newtype_pacman'

This commit is contained in:
Nico Schottelius 2015-05-20 14:06:04 +02:00
commit 2985bd709a
14 changed files with 778 additions and 0 deletions

View file

@ -0,0 +1,72 @@
cdist-type__pacman_conf(7)
==========================
Dominique Roux <dominique.roux4@gmail.com>
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).

View file

@ -0,0 +1,134 @@
#!/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 <http://www.gnu.org/licenses/>.
#
#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)
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"
#set global variables
MATCH=0
#function for check if array contain string
contains_element() {
MATCH=0
target=$1
keys="${@:2}"
for key in ${keys}; do
if [ "${key}" == "${target}" ]; then
MATCH=1
return 0
fi
done
MATCH=0
}
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
exit 0
else
echo "ERROR: Unknown state: ${state}" >&2
exit 0
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}" "${boolean_option_keys}"
if [ "${MATCH}" -eq 1 ]; 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}" "${allowed_option_keys}"
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: ${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}" "${allowed_repo_keys}"
if [ ${MATCH} -eq 0 ]; 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: Unknown state: ${state}" >&2
fi
fi

View file

@ -0,0 +1,2 @@

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1,2 @@
file
state

View file

@ -0,0 +1,3 @@
section
key
value

View file

@ -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

View file

@ -0,0 +1,6 @@
[options]
HoldPkg = pacman glibc
Architecture = auto
CheckSpace
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional

View file

@ -0,0 +1,6 @@
#
# cdist managed - do not change
#
Include = /etc/pacman.d/options
Include = /etc/pacman.d/repo_*
Include = /etc/pacman.d/plain_file_*

View file

@ -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

View file

@ -0,0 +1,48 @@
cdist-type__pacman_integrate(7)
===============================
Dominique Roux <dominique.roux4@gmail.com>
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).

View file

@ -0,0 +1,59 @@
#!/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 <http://www.gnu.org/licenses/>.
#
state=$(cat $__object/parameter/state 2>/dev/null)
path="/etc/"
if [ "${state}" == "present" ]; then
__file /etc/pacman.conf\
--owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist
__file /etc/pacman.d/options\
--owner root --group root --mode 644 --source $__type/files/options
__file /etc/pacman.d/repo_empty_placeholder\
--owner root --group root --mode 644
__file /etc/pacman.d/plain_file_empty_placeholder\
--owner root --group root --mode 644
elif [ "${state}" == "absent" ]; then
__file /etc/pacman.conf\
--owner root --group root --mode 644 --source $__type/files/pacman.conf.pacman
__file /etc/pacman.d/mirrorlist\
--owner root --group root --mode 644 --source $__type/files/mirrorlist
__file /etc/pacman.d/options\
--state absent
__file /etc/pacman.d/repo_empty_placeholder\
--state absent
__file /etc/pacman.d/plain_file_empty_placeholder\
--state absent
else
echo "ERROR: Unknown state: ${state}" >&2
fi

View file

@ -0,0 +1 @@
present

View file

@ -0,0 +1 @@
state