Commit 9eaa21c5 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add support for archlinux

 * Fix distro detection code to detect arch linux systems
 * Fix AssighHostname hook to successfully assign the host name on
   arch linux systems
parent e97ba414
......@@ -97,6 +97,8 @@ get_base_distro() {
echo "suse"
elif [ -e "$root_dir/etc/gentoo-release" ]; then
echo "gentoo"
elif [ -e "$root_dir/etc/arch-release" ]; then
echo "arch"
else
warn "Unknown base distro."
fi
......@@ -126,6 +128,8 @@ get_distro() {
echo "suse"
elif [ -e "$root_dir/etc/gentoo-release" ]; then
echo "gentoo"
elif [ -e "$root_dir/etc/arch-release" ]; then
echo "arch"
else
warn "Unknown distro."
fi
......
......@@ -69,6 +69,13 @@ linux_hostname() {
echo "$hostname" > "${target}/etc/HOSTNAME";;
gentoo)
sed -ie "s/\(\(HOSTNAME\)\|\(hostname\)\)=.*$/\1=\"$hostname\"/" "$target/etc/conf.d/hostname";;
arch)
sed -ie "s/^HOSTNAME=.*$/HOSTNAME=\"$hostname\"/" "$target/etc/rc.conf"
if grep "^127\.0\.0\.1[ \t]*" "$target/etc/hosts" > /dev/null; then
sed -ie "s/127\.0\.0\.1[ \t]*.*$/127.0.0.1\t$hostname/" "$target/etc/hosts"
else
echo -e "127.0.0.1\t$hostname" >> "$target/etc/hosts"
fi;;
*) log_error "Don't know how to assign hostname. Unknown linux distribution.";;
esac
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment