Merge remote-tracking branch 'origin/pr/77'

* origin/pr/77:
  archlinux: fix update-proxy-configs to use pacman.d drop-ins
  archlinux: ensure repositories are the last pacman.d files included
  archlinux: Setup default package repository
  archlinux: switch to usage of pacman.d drop-ins
This commit is contained in:
Marek Marczykowski-Górecki 2016-07-13 22:25:26 +02:00
commit 0eb1f7c679
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
6 changed files with 56 additions and 44 deletions

View File

@ -6,7 +6,7 @@
# Maintainer: Olivier Medoc <o_medoc@yahoo.fr>
pkgname=qubes-vm-core
pkgver=`cat version`
pkgrel=7
pkgrel=9
epoch=
pkgdesc="The Qubes core files for installation inside a Qubes VM."
arch=("x86_64")
@ -25,11 +25,18 @@ options=()
install=PKGBUILD.install
changelog=
source=(PKGBUILD.qubes-ensure-lib-modules.service PKGBUILD.qubes-update-desktop-icons.hook)
source=( PKGBUILD.qubes-ensure-lib-modules.service PKGBUILD.qubes-update-desktop-icons.hook
PKGBUILD-qubes-noupgrade.conf
PKGBUILD-qubes-repo-3.1.conf
PKGBUILD-qubes-repo-3.2.conf
)
noextract=()
md5sums=('88f4b3d5b156888a9d38f5bc28702ab8' 'bbfb946d6d2787e5abf8e2236502a3d4')
md5sums=( '88f4b3d5b156888a9d38f5bc28702ab8' 'bbfb946d6d2787e5abf8e2236502a3d4'
'c1c1b86eed48cc0f943f21b9a1df8b8e'
'36bf82df048e81250e7ba80b3224bddc'
'd5898def7bad7fd92ea60f0bf48174e3'
)
build() {
@ -82,6 +89,15 @@ package() {
mkdir -p ${pkgdir}/usr/share/libalpm/hooks/
install -m 644 $srcdir/PKGBUILD.qubes-update-desktop-icons.hook ${pkgdir}/usr/share/libalpm/hooks/qubes-update-desktop-icons.hook
# Install pacman.d drop-ins (at least 1 drop-in must be installed or pacman will fail)
mkdir -p ${pkgdir}/etc/pacman.d
install -m 644 $srcdir/PKGBUILD-qubes-noupgrade.conf ${pkgdir}/etc/pacman.d/10-qubes-noupgrade.conf
# Install pacman repository
release=`echo $pkgver | cut -d '.' -f 1,2`
echo "Installing repository for release ${release}"
install -m 644 $srcdir/PKGBUILD-qubes-repo-${release}.conf ${pkgdir}/etc/pacman.d/99-qubes-repository-${release}.conf
# Archlinux specific: enable autologin on tty1
mkdir -p $pkgdir/etc/systemd/system/getty@tty1.service.d/
cat <<EOF > $pkgdir/etc/systemd/system/getty@tty1.service.d/autologin.conf

View File

@ -0,0 +1,2 @@
NoUpgrade = etc/pam.d/su
NoUpgrade = etc/pam.d/su-l

View File

@ -0,0 +1,2 @@
[qubes-r3.1]
Server = http://olivier.medoc.free.fr/archlinux/$repo

View File

@ -0,0 +1,2 @@
[qubes-r3.2]
Server = http://olivier.medoc.free.fr/archlinux/$repo

View File

@ -202,68 +202,47 @@ config_prependtomark() {
FILE=$1
APPENDBEFORELINE=$2
APPENDLINE=$3
grep -q "$APPENDLINE" "$FILE" || sed "/$APPENDBEFORELINE/i$APPENDLINE" -i "$FILE"
grep -F -q "$APPENDLINE" "$FILE" || sed "/$APPENDBEFORELINE/i$APPENDLINE" -i "$FILE"
}
config_appendtomark() {
FILE=$1
APPENDAFTERLINE=$2
APPENDLINE=$3
grep -q "$APPENDLINE" "$FILE" || sed "/$APPENDAFTERLINE/a$APPENDLINE" -i "$FILE"
grep -F -q "$APPENDLINE" "$FILE" || sed "/$APPENDAFTERLINE/a$APPENDLINE" -i "$FILE"
}
config_cleanupmark() {
FILE="$1"
BEGINMARK="$2"
ENDMARK="$3"
if grep -q "$BEGINMARK" "$FILE"; then
if grep -q "$ENDMARK" "$FILE"; then
if grep -F -q "$BEGINMARK" "$FILE"; then
if grep -F -q "$ENDMARK" "$FILE"; then
cp "$FILE" "$FILE.qubes-update-orig"
sed -i -e "/^$BEGINMARK\$/,/^$ENDMARK\$/{
/^$ENDMARK\$/b
sed -i -e "/^$BEGINMARK$/,/^$ENDMARK$/{
/^$ENDMARK$/b
/^$BEGINMARK$/!d
}" "$FILE"
rm -f "$FILE.qubes-update-orig"
else
echo "ERROR: found $BEGINMARK marker but not $ENDMARK in $FILE. Please cleanup this file manually."
fi
elif grep -q "$ENDMARK" "$FILE"; then
elif grep -F -q "$ENDMARK" "$FILE"; then
echo "ERROR: found $ENDMARK marker but not $BEGINMARK in $FILE. Please cleanup this file manually."
fi
}
update_finalize() {
# Archlinux specific: Prepare pacman.conf to add qubes specific config
# Archlinux specific: Cleanup pre pacman.d qubes marker
QUBES_MARKER="### QUBES CONFIG MARKER ###"
config_prependtomark "/etc/pacman.conf" "# REPOSITORIES" "$QUBES_MARKER"
if grep -F -q "$QUBES_MARKER" /etc/pacman.conf; then
config_prependtomark "/etc/pacman.conf" "# REPOSITORIES" "### QUBES CONFIG END MARKER ###"
config_cleanupmark "/etc/pacman.conf" "$QUBES_MARKER" "### QUBES CONFIG END MARKER ###"
fi
# Ensure pam.d will not be modified by archlinux package updates
config_appendtomark '/etc/pacman.conf' "$QUBES_MARKER" 'NoUpgrade = etc/pam.d/su'
config_appendtomark '/etc/pacman.conf' "$QUBES_MARKER" 'NoUpgrade = etc/pam.d/su-l'
# Add Qubes setup script markers at the right place (this won't work at the end of pacman.conf)"
config_appendtomark "/etc/pacman.conf" "$QUBES_MARKER" "### QUBES END ###"
config_appendtomark "/etc/pacman.conf" "$QUBES_MARKER" "### QUBES BEGIN ###"
## Archlinux specific: Cleanup pre pacman.d qubes marker
## Commented out until pacman.d snipped are supported
#QUBES_MARKER="### QUBES CONFIG MARKER ###"
#if grep -q "$QUBES_MARKER" /etc/pacman.conf; then
# if ! grep -q "### QUBES CONFIG END MARKER ###" /etc/pacman.conf; then
# # Perform cleanup before continuing
# config_prependtomark "/etc/pacman.conf" "# REPOSITORIES" "### QUBES CONFIG END MARKER ###"
# config_cleanupmark "/etc/pacman.conf" "$QUBES_MARKER" "### QUBES CONFIG END MARKER ###"
# fi
#fi
#config_prependtomark "/etc/pacman.conf" "# REPOSITORIES" "$QUBES_MARKER"
#config_prependtomark "/etc/pacman.conf" "# REPOSITORIES" "### QUBES CONFIG END MARKER ###"
#
## Add qubes includes
#config_appendtomark "/etc/pacman.conf" "$QUBES_MARKER" "Include /etc/pacman.d/qubes-noupdate.conf"
#config_appendtomark "/etc/pacman.conf" "$QUBES_MARKER" "Include /etc/pacman.d/qubes-updateproxy.conf"
#config_prependtomark "/etc/pacman.conf" "### QUBES CONFIG END MARKER ###" "Include /etc/pacman.d/qubes-repositories.conf"
# Include /etc/pacman.d drop-in directory
config_appendtomark "/etc/pacman.conf" "$QUBES_MARKER" "Include = /etc/pacman.d/*.conf"
# Archlinux specific: Update pam.d configuration for su to enable systemd-login wrapper
# Also remove pam_unix.so from su configuration

View File

@ -108,6 +108,22 @@ $PROXY_CONF_ENTRY
EOF
fi
# Pacman (archlinux) also
if [ -d /etc/pacman.d ]; then
if [ -n "$PROXY_ADDR" ]; then
cat > /etc/pacman.d/01-qubes-proxy.conf <<EOF
### This file is automatically generated by Qubes ($0 script).
### All modifications here will be lost.
### If you want to override some of this settings, create another file under
### /etc/pacman.d
XferCommand = http_proxy=$PROXY_ADDR /usr/bin/curl -C - -f %u > %o
EOF
else
rm -r /etc/pacman.d/01-qubes-proxy.conf
fi
fi
# DNF configuration doesn't support including other files
# https://bugzilla.redhat.com/show_bug.cgi?id=1352234
if [ -e /etc/dnf/dnf.conf ]; then
@ -119,8 +135,3 @@ fi
if [ -e /etc/PackageKit/PackageKit.conf ]; then
update_conf /etc/PackageKit/PackageKit.conf "ProxyHTTP=$PROXY_ADDR"
fi
# Pacman (archlinux) also
if [ -e /etc/pacman.conf ]; then
update_conf /etc/pacman.conf "XferCommand = http_proxy=$PROXY_ADDR /usr/bin/curl -C - -f %u > %o"
fi