aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-09-18 09:53:02 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-09-18 09:53:02 +0000
commit529426cca93f7466eda8392b82e9dd4bc97b54ea (patch)
tree4709a6f612bb75a38a77108922dd92b1a0c698bf /main
parenta68ccf7f2fcd0d5631ebf64b6099ad775b06aea4 (diff)
downloadaports-529426cca93f7466eda8392b82e9dd4bc97b54ea.tar.bz2
aports-529426cca93f7466eda8392b82e9dd4bc97b54ea.tar.xz
main/alpine-conf: use uuid in setup-disk
fixes #169
Diffstat (limited to 'main')
-rw-r--r--main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch50
-rw-r--r--main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch74
-rw-r--r--main/alpine-conf/APKBUILD7
3 files changed, 79 insertions, 52 deletions
diff --git a/main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch b/main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch
deleted file mode 100644
index 2b01b0eadc..0000000000
--- a/main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From d1f2db71733268da8097db02326e7f5332671f86 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Tue, 15 Sep 2009 08:57:32 +0000
-Subject: [PATCH] setup-alpine: add the hostname to /etc/hosts
-
----
- setup-alpine.in | 23 +++++++++++++++++++++++
- 1 files changed, 23 insertions(+), 0 deletions(-)
-
-diff --git a/setup-alpine.in b/setup-alpine.in
-index 3472f53..712a950 100644
---- a/setup-alpine.in
-+++ b/setup-alpine.in
-@@ -6,6 +6,16 @@ VERSION=@VERSION@
- PREFIX=
- . $PREFIX/lib/libalpine.sh
-
-+# Extract fully qualified domain name from current hostname. If none is
-+# currently set, use 'my.domain'.
-+get_fqdn() {
-+ local _dn
-+ _dn=$(hostname -f 2>/dev/null)
-+ _dn=${_dn#$(hostname -s 2>/dev/null)}
-+ _dn=${_dn#.}
-+ echo "${_dn:=my.domain}"
-+}
-+
- while getopts "ah" opt ; do
- case $opt in
- a) ARCHIVE=yes;;
-@@ -42,3 +52,16 @@ rc-update -q add networking boot
- rc boot
- rc default
-
-+# update /etc/hosts - after we have got dhcp address
-+# Get default fully qualified domain name from *first* domain
-+# given on *last* search or domain statement.
-+_dn=$(sed -n \
-+-e '/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}' \
-+-e '/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}' \
-+-e '${g;p;}' /etc/resolv.conf 2>/dev/null)
-+
-+_hn=$(hostname)
-+_hn=${_hn%%.*}
-+
-+sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn)} ${_hn} localhost.localdomain localhost/" /etc/hosts
-+
---
-1.6.4.2
-
diff --git a/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch b/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch
new file mode 100644
index 0000000000..6e248ed91a
--- /dev/null
+++ b/main/alpine-conf/0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch
@@ -0,0 +1,74 @@
+From 5531beb030b8e0a2f0da5ba5b8833bb01ba21c85 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 17 Sep 2009 11:57:45 +0000
+Subject: [PATCH] setup-disk: use uuid in fstab and extlinux.conf
+
+This helps us avoid the issues when disk changes from sda to hda
+---
+ setup-disk.in | 31 ++++++++++++++++++++++++++++---
+ 1 files changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/setup-disk.in b/setup-disk.in
+index a957b09..881c341 100644
+--- a/setup-disk.in
++++ b/setup-disk.in
+@@ -15,12 +15,37 @@ in_list() {
+ return 1
+ }
+
++# wrapper to only show given device
++_blkid() {
++ blkid | grep "^$1:"
++}
++
++# if given device have an UUID display it, otherwise return the device
++uuid_or_device() {
++ local i=
++ for i in $(_blkid "$1"); do
++ case "$i" in
++ UUID=*) eval $i;;
++ esac
++ done
++ if [ -n "$UUID" ]; then
++ echo "UUID=$UUID"
++ else
++ echo "$1"
++ fi
++}
++
++# generate an fstab from a given mountpoint. Convert to UUID if possible
+ enumerate_fstab() {
+ local mnt="$1"
++ local fs_spec= fs_file= fs_vfstype= fs_mntops= fs_freq= fs_passno=
+ [ -z "$mnt" ] && return
+ local escaped_mnt=$(echo $mnt | sed 's:/:\\/:g')
+ awk "\$2 ~ /^$escaped_mnt/ {print \$0}" /proc/mounts | \
+- sed "s:$mnt:/:g; s: :\t:g" | sed 's:/\+:/:g'
++ sed "s:$mnt:/:g; s: :\t:g" | sed 's:/\+:/:g' | \
++ while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno; do
++ echo -e "$(uuid_or_device $fs_spec)\t${fs_file}\t${fs_vfstype}\t${fs_mntops} ${fs_freq} ${fs_passno}"
++ done
+ }
+
+ is_vmware() {
+@@ -89,7 +114,7 @@ prompt 1
+ default grsec
+ label grsec
+ kernel /grsec
+- append initrd=/grsec.gz root=$rootdev modules=sd-mod,usb-storage,ext3$raidmod ${pax_nouderef}quiet
++ append initrd=/grsec.gz root=$(uuid_or_device $rootdev) modules=sd-mod,usb-storage,ext3$raidmod ${pax_nouderef}quiet
+ EOF
+ # fix the fstab
+ enumerate_fstab "$mnt" >> "$mnt"/etc/fstab
+@@ -247,7 +272,7 @@ EOF
+ rc-update --quiet add swap boot
+ # the func to generate fstab does not detect swap. add it manually
+ sed -i -e '/swap/d' /etc/fstab
+- echo -e "$swap_dev\tswap\t\tswap\tdefaults 0 0" >> /etc/fstab
++ echo -e "$(uuid_or_device $swap_dev)\tswap\t\tswap\tdefaults 0 0" >> /etc/fstab
+ install_mounted_root /mnt
+ }
+
+--
+1.6.4.2
+
diff --git a/main/alpine-conf/APKBUILD b/main/alpine-conf/APKBUILD
index 4fb6f000ae..cc75243585 100644
--- a/main/alpine-conf/APKBUILD
+++ b/main/alpine-conf/APKBUILD
@@ -1,16 +1,18 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alpine-conf
pkgver=2.0_rc5
-pkgrel=0
+pkgrel=1
pkgdesc="Alpine configuration management scripts"
url=http://git.alpinelinux.org/cgit/$pkgname
depends="openrc"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
+ 0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch
"
license="GPL-2"
build() {
cd "$srcdir/$pkgname-$pkgver"
+ patch -p1 -i ../0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch || return 1
make || return 1
make install PREFIX= DESTDIR="$pkgdir"
@@ -18,4 +20,5 @@ build() {
ln -s lbu "$pkgdir"/sbin/lbu_$i
done
}
-md5sums="0b5f8fece27412aa9d810dfaddd2aee0 alpine-conf-2.0_rc5.tar.bz2"
+md5sums="0b5f8fece27412aa9d810dfaddd2aee0 alpine-conf-2.0_rc5.tar.bz2
+47c14e0f404c555f898b140f338f2847 0001-setup-disk-use-uuid-in-fstab-and-extlinux.conf.patch"