iankelling.org
/
git
/
automated-distro-installer
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5177fb7
)
avoid future errors with overwriting symlnks
author
Ian Kelling
<ian@iankelling.org>
Tue, 9 Aug 2016 22:51:56 +0000
(15:51 -0700)
committer
Ian Kelling
<ian@iankelling.org>
Mon, 6 Feb 2017 06:21:41 +0000
(22:21 -0800)
arch-init
patch
|
blob
|
history
arch-init-chroot
patch
|
blob
|
history
arch-pxe
patch
|
blob
|
history
debian-preseed
patch
|
blob
|
history
fai/config/class/50-host-classes
patch
|
blob
|
history
fai/config/distro-install-common/end
patch
|
blob
|
history
faiserver-disable
patch
|
blob
|
history
faiserver-enable
patch
|
blob
|
history
faiserver-setup
patch
|
blob
|
history
diff --git
a/arch-init
b/arch-init
index 36b77c6b6851ca851b48949abf9db399ff3c39f4..0ce3bf01d1bfc3d6f981d4fa9148840f4bd196d9 100755
(executable)
--- a/
arch-init
+++ b/
arch-init
@@
-57,7
+57,7
@@
export bootn=3
export swapn=2
export BOOT_DEVICE
export ROOT_PARTITIONS
export swapn=2
export BOOT_DEVICE
export ROOT_PARTITIONS
-sed -ri "/^crypt_dev_\S+$rootn /d" /tmp/fai/crypttab
+sed -ri
--follow-symlinks
"/^crypt_dev_\S+$rootn /d" /tmp/fai/crypttab
if ! $already_partitioned; then
mount -o subvol=root_$DISTRO $ROOT_PARTITION /mnt
if ! $already_partitioned; then
mount -o subvol=root_$DISTRO $ROOT_PARTITION /mnt
diff --git
a/arch-init-chroot
b/arch-init-chroot
index c6e49936126f45e1ca4235a5d3d2d3fed2630dfc..abd9a08ae8c3cc67abbf9e2cf6caa21ad37fa76e 100755
(executable)
--- a/
arch-init-chroot
+++ b/
arch-init-chroot
@@
-24,9
+24,9
@@
echo "LANG=$l" > /etc/locale.conf
# # https://bugs.archlinux.org/task/42884
# # disabled, as with just the module, startup spammed something about
# # command takes a device name and something else.
# # https://bugs.archlinux.org/task/42884
# # disabled, as with just the module, startup spammed something about
# # command takes a device name and something else.
-# sed -ri '/^ *MODULES *=.*btrfs/!s/^( *MODULES *=.*)"/\1 btrfs"/' /etc/mkinitcpio.conf
+# sed -ri
--follow-symlinks
'/^ *MODULES *=.*btrfs/!s/^( *MODULES *=.*)"/\1 btrfs"/' /etc/mkinitcpio.conf
# # remove extra space
# # remove extra space
-# sed -ri 's/^( *MODULES *=[^"]*)" */\1"/' /etc/mkinitcpio.conf
+# sed -ri
--follow-symlinks
's/^( *MODULES *=[^"]*)" */\1"/' /etc/mkinitcpio.conf
@@
-74,20
+74,20
@@
base=/usr/lib/initcpio
# https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Configuring_mkinitcpio_2
# used to have lvm2 after encrypt for lvm, but not using lvm anymore
for x in encrypt btrfs; do
# https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Configuring_mkinitcpio_2
# used to have lvm2 after encrypt for lvm, but not using lvm anymore
for x in encrypt btrfs; do
- sed -ri -f - /etc/mkinitcpio.conf <<EOF
+ sed -ri -
-follow-symlinks -
f - /etc/mkinitcpio.conf <<EOF
/^ *HOOKS.*\b$x\b/!s/^( *HOOKS=.*)filesystems/\1$x filesystems/
EOF
done
# this is the default file, otherwise you use cryptkey=device:fstype:path
/^ *HOOKS.*\b$x\b/!s/^( *HOOKS=.*)filesystems/\1$x filesystems/
EOF
done
# this is the default file, otherwise you use cryptkey=device:fstype:path
-sed -ri -f - /etc/mkinitcpio.conf <<EOF
+sed -ri -
-follow-symlinks -
f - /etc/mkinitcpio.conf <<EOF
s#^\s*FILES=.*#FILES="/crypto_keyfile.bin"#
EOF
echo "$0: FILES:"
grep FILES /etc/mkinitcpio.conf
k_args="${k_args[*]}"
echo "$0: grub cmdline additions: $k_args"
s#^\s*FILES=.*#FILES="/crypto_keyfile.bin"#
EOF
echo "$0: FILES:"
grep FILES /etc/mkinitcpio.conf
k_args="${k_args[*]}"
echo "$0: grub cmdline additions: $k_args"
-sed -ri -f - /etc/default/grub <<EOF
+sed -ri -
-follow-symlinks -
f - /etc/default/grub <<EOF
\%$k_args%!s%^ *GRUB_CMDLINE_LINUX_DEFAULT *= *"%\0$k_args %
EOF
\%$k_args%!s%^ *GRUB_CMDLINE_LINUX_DEFAULT *= *"%\0$k_args %
EOF
@@
-96,7
+96,7
@@
mkinitcpio -p linux
# remove the default quiet arg.
# this doesn't seem to affect anything, so leave it alone.
# remove the default quiet arg.
# this doesn't seem to affect anything, so leave it alone.
-#sed -ri 's/^( *GRUB_CMDLINE_LINUX_DEFAULT *= *.*) ?\bquiet\b(.*)/\1\2/' /etc/default/grub
+#sed -ri
--follow-symlinks
's/^( *GRUB_CMDLINE_LINUX_DEFAULT *= *.*) ?\bquiet\b(.*)/\1\2/' /etc/default/grub
# https://wiki.archlinux.org/index.php/GRUB#Install_to_disk
for dev in $BOOT_DEVICE; do
# https://wiki.archlinux.org/index.php/GRUB#Install_to_disk
for dev in $BOOT_DEVICE; do
@@
-124,7
+124,7
@@
usermod -aG games,rfkill,users,uucp,wheel ian
pacman -S --noconfirm net-tools # for route
# get the mac of the interface used by the broadcast route.
pacman -S --noconfirm net-tools # for route
# get the mac of the interface used by the broadcast route.
-mac=$(cat /sys/class/net/$(route -n | sed -rn 's/^0\.0\.0\.0.*[[:space:]]([^[:space:]]+)[[:space:]]*$/\1/p')/address)
+mac=$(cat /sys/class/net/$(route -n | sed -rn
--follow-symlinks
's/^0\.0\.0\.0.*[[:space:]]([^[:space:]]+)[[:space:]]*$/\1/p')/address)
# simple bridge.
# simple bridge.
diff --git
a/arch-pxe
b/arch-pxe
index 66a79debe7f6bf6643d2b2fec808c27216aebbf6..68b288f71269e5f21aa15c7f8f20423c318f467e 100755
(executable)
--- a/
arch-pxe
+++ b/
arch-pxe
@@
-13,7
+13,7
@@
iso="archlinux-2016.05.01-dual"
sfs=$iso/arch/x86_64/airootfs.sfs
rm -rf $iso
ex $iso.iso
sfs=$iso/arch/x86_64/airootfs.sfs
rm -rf $iso
ex $iso.iso
-sed -i -f - $iso/arch/boot/syslinux/archiso_pxe64.cfg <<EOF
+sed -i -
-follow-symlinks -
f - $iso/arch/boot/syslinux/archiso_pxe64.cfg <<EOF
1itotaltimeout 1
/^LABEL arch64_nfs/a menu default
s/^APPEND .*/\0 script=arch-iso-init.sh/
1itotaltimeout 1
/^LABEL arch64_nfs/a menu default
s/^APPEND .*/\0 script=arch-iso-init.sh/
diff --git
a/debian-preseed
b/debian-preseed
index 98ee46c85785d0e817b07b1256904e46489a4746..aa671a425130ca2a4c3fba4b8f54eb88dae29b2a 100755
(executable)
--- a/
debian-preseed
+++ b/
debian-preseed
@@
-50,7
+50,7
@@
case $distro in
ubuntu-14.04)
wget -q https://help.ubuntu.com/lts/installation-guide/$preseed
wget -qN http://archive.ubuntu.com/ubuntu/dists/trusty/$neboot_path
ubuntu-14.04)
wget -q https://help.ubuntu.com/lts/installation-guide/$preseed
wget -qN http://archive.ubuntu.com/ubuntu/dists/trusty/$neboot_path
- sed -ri 's!^tasksel tasksel/first multiselect .*!#\0!' $preseed
+ sed -ri
--follow-symlinks
's!^tasksel tasksel/first multiselect .*!#\0!' $preseed
echo 'tasksel tasksel/first multiselect ubuntu-server, openssh-server' >>$preseed
;;
debian-jessie)
echo 'tasksel tasksel/first multiselect ubuntu-server, openssh-server' >>$preseed
;;
debian-jessie)
@@
-86,23
+86,24
@@
tar xzf netboot.tar.gz
# keymap=us is only needed for debian.
pxe_cfg=${distro%-*}-installer/amd64/boot-screens/txt.cfg
# keymap=us is only needed for debian.
pxe_cfg=${distro%-*}-installer/amd64/boot-screens/txt.cfg
-sed -ri "s#^[[:space:]]*append[[:space:]]#\0auto priority=critical locale=en_US.UTF-8 netcfg/choose_interface=auto url=tftp://$ip/example-preseed.txt keymap=us#" $pxe_cfg
+sed="sed -ri --follow-symlinks"
+$sed "s#^[[:space:]]*append[[:space:]]#\0auto priority=critical locale=en_US.UTF-8 netcfg/choose_interface=auto url=tftp://$ip/example-preseed.txt keymap=us#" $pxe_cfg
# various google results say timeout x will result in doing the default thing,
# but that doesn't happen. no idea why. Maybe it needed to be part of the label.
echo 'totaltimeout 1' | tee -a $pxe_cfg
if $interactive_partition; then
# various google results say timeout x will result in doing the default thing,
# but that doesn't happen. no idea why. Maybe it needed to be part of the label.
echo 'totaltimeout 1' | tee -a $pxe_cfg
if $interactive_partition; then
-
sed -ri
's/^d-i[[:space:]]partman.*/#\0/' $preseed
+
$sed
's/^d-i[[:space:]]partman.*/#\0/' $preseed
# at least in ubuntu, this does automatic selection of boot device,
# and on a server where we setup raid, it choose sda, and failed
# and the whole installation could not be salvaged.
# at least in ubuntu, this does automatic selection of boot device,
# and on a server where we setup raid, it choose sda, and failed
# and the whole installation could not be salvaged.
-
sed -ri
's/^d-i[[:space:]]grub-installer.*/#\0/' $preseed
+
$sed
's/^d-i[[:space:]]grub-installer.*/#\0/' $preseed
fi
fi
-
sed -ri
"s#(^d-i time/zone string US/).*#\1Pacific#" $preseed
-
sed -ri
'/^xserver-xorg/,/[^\\$]/ s/.*/#\0/' $preseed
+
$sed
"s#(^d-i time/zone string US/).*#\1Pacific#" $preseed
+
$sed
'/^xserver-xorg/,/[^\\$]/ s/.*/#\0/' $preseed
# we set the locale in kernel args. maybe we don't need to. this overrides it.
# we set the locale in kernel args. maybe we don't need to. this overrides it.
-
sed -ri
's!^d-i[[:space:]]debian-installer/locale[[:space:]].*!#\0!' $preseed
+
$sed
's!^d-i[[:space:]]debian-installer/locale[[:space:]].*!#\0!' $preseed
# for secure pass, set the shadow option with mkpasswd -s -m sha-512 < passfile
# for secure pass, set the shadow option with mkpasswd -s -m sha-512 < passfile
diff --git
a/fai/config/class/50-host-classes
b/fai/config/class/50-host-classes
index 3548b1f001c8931e7bb2285b2d91b8ecdfbf3b1b..ef7023955b8a891bf13b75a1460ead6ea8706a6b 100755
(executable)
--- a/
fai/config/class/50-host-classes
+++ b/
fai/config/class/50-host-classes
@@
-12,7
+12,7
@@
case $HOSTNAME in
x2)
echo "FAIBASE DEBIAN DESKTOP PARTITION_PROMPT" ;;
tp)
x2)
echo "FAIBASE DEBIAN DESKTOP PARTITION_PROMPT" ;;
tp)
- echo "FAIBASE DEBIAN DESKTOP PARTITION_PROMPT
STABLE
" ;;
+ echo "FAIBASE DEBIAN DESKTOP PARTITION_PROMPT" ;;
frodo)
echo "FAIBASE DEBIAN DESKTOP PARTITION_PROMPT" ;;
treetowl)
frodo)
echo "FAIBASE DEBIAN DESKTOP PARTITION_PROMPT" ;;
treetowl)
diff --git
a/fai/config/distro-install-common/end
b/fai/config/distro-install-common/end
index 6be266ebacfedd9b4e8a61d0b9bd14ece91a0267..390c20487c4c944b4dfd96a81d1b13b313f33eca 100755
(executable)
--- a/
fai/config/distro-install-common/end
+++ b/
fai/config/distro-install-common/end
@@
-62,7
+62,7
@@
$ROOTCMD usermod -a -G traci ian
f=$target/etc/sysctl.d/99-sysctl.conf
key=fs.inotify.max_user_watches
f=$target/etc/sysctl.d/99-sysctl.conf
key=fs.inotify.max_user_watches
-if [[ -e $f ]]; then sed -ri "/^\s*$key\s*=/d" $f; fi
+if [[ -e $f ]]; then sed -ri
--follow-symlinks
"/^\s*$key\s*=/d" $f; fi
echo "fs.inotify.max_user_watches = 1000000" >> $f
# applies it. it would be also be applied after a reboot
$ROOTCMD sysctl --system
echo "fs.inotify.max_user_watches = 1000000" >> $f
# applies it. it would be also be applied after a reboot
$ROOTCMD sysctl --system
diff --git
a/faiserver-disable
b/faiserver-disable
index 7893524426844344d3d5e6d5f16d5c95db14b8b1..8f920d8b7b386f1e81adf28835bd30600932c73a 100755
(executable)
--- a/
faiserver-disable
+++ b/
faiserver-disable
@@
-15,4
+15,4
@@
if [[ $1 ]]; then
usage 1
fi
usage 1
fi
-ssh root@$(chost faiserver) "sed -ri 's,^/srv/fai/,#\0,' /etc/exports; exportfs -ra"
+ssh root@$(chost faiserver) "sed -ri
--follow-symlinks
's,^/srv/fai/,#\0,' /etc/exports; exportfs -ra"
diff --git
a/faiserver-enable
b/faiserver-enable
index a71227c3b16bcf2ca713a96bc1e870379685059b..66e0bee8e5a108cfcc4184b9c3871d53d10669a6 100755
(executable)
--- a/
faiserver-enable
+++ b/
faiserver-enable
@@
-15,4
+15,4
@@
if [[ $1 ]]; then
usage 1
fi
usage 1
fi
-ssh root@$(chost faiserver) "sed -ri 's,^\s*#\s*(/srv/fai/.*),\1,' /etc/exports; exportfs -ra"
+ssh root@$(chost faiserver) "sed -ri
--follow-symlinks
's,^\s*#\s*(/srv/fai/.*),\1,' /etc/exports; exportfs -ra"
diff --git
a/faiserver-setup
b/faiserver-setup
index 0510b407a4a9117d4ea5c060104dc2d0696335a0..b9b6d74c8d535e25d691999154d478666137b176 100755
(executable)
--- a/
faiserver-setup
+++ b/
faiserver-setup
@@
-34,12
+34,13
@@
if [[ $to_install ]]; then
apt-get -y install ${to_install[@]}
fi
apt-get -y install ${to_install[@]}
fi
-sed -i 's/^#deb/deb/' /etc/fai/apt/sources.list
-sed -i 's/#LOGUSER/LOGUSER/' /etc/fai/fai.conf
+sed="sed -ri --follow-symlinks"
+$sed 's/^#deb/deb/' /etc/fai/apt/sources.list
+$sed 's/#LOGUSER/LOGUSER/' /etc/fai/fai.conf
# from man fai-make-nfsroot,
# figured out after partitioning ignored my crypt partition
if ! grep cryptsetup /etc/fai/NFSROOT &>/dev/null; then
# from man fai-make-nfsroot,
# figured out after partitioning ignored my crypt partition
if ! grep cryptsetup /etc/fai/NFSROOT &>/dev/null; then
-
sed -ri
'/^PACKAGES install$/a cryptsetup' /etc/fai/NFSROOT
+
$sed
'/^PACKAGES install$/a cryptsetup' /etc/fai/NFSROOT
fi
fai-setup -vf
{ head -n 1 /srv/fai/nfsroot/root/.ssh/known_hosts | awk '{print $1}' \
fi
fai-setup -vf
{ head -n 1 /srv/fai/nfsroot/root/.ssh/known_hosts | awk '{print $1}' \
@@
-47,7
+48,7
@@
fai-setup -vf
} >>/srv/fai/nfsroot/root/.ssh/known_hosts
# this does not alter the config on a new install
} >>/srv/fai/nfsroot/root/.ssh/known_hosts
# this does not alter the config on a new install
-
sed -ri
's#^([[:space:]]*TFTP_DIRECTORY[[:space:]]*=).*#\1"/srv/tftp"#' \
+
$sed
's#^([[:space:]]*TFTP_DIRECTORY[[:space:]]*=).*#\1"/srv/tftp"#' \
/etc/default/tftpd-hpa
service tftpd-hpa restart
/etc/default/tftpd-hpa
service tftpd-hpa restart
@@
-93,6
+94,6
@@
apt-get -y install apt-cacher-ng
# the logsave prompted because the hostname faiserver was uknown.
# Here it was faiserver.lan when running from a faiserver vm.
# When running from a normal host with faiserver alias, it was the normal hosts name.
# the logsave prompted because the hostname faiserver was uknown.
# Here it was faiserver.lan when running from a faiserver vm.
# When running from a normal host with faiserver alias, it was the normal hosts name.
-
sed -ri
's/(^[^,]+,)\S+/\1faiserver/' /srv/fai/nfsroot/root/.ssh/known_hosts
+
$sed
's/(^[^,]+,)\S+/\1faiserver/' /srv/fai/nfsroot/root/.ssh/known_hosts
# ditch the logo banner up top which screws with less.
touch /srv/fai/nfsroot/.nocolorlogo
# ditch the logo banner up top which screws with less.
touch /srv/fai/nfsroot/.nocolorlogo