diff options
author | Riku Voipio <riku.voipio@linaro.org> | 2017-09-12 16:20:45 +0300 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2017-09-12 16:20:45 +0300 |
commit | b88be690c7393075e5b24f8af245fd7197ee584e (patch) | |
tree | c2dedfb2fb9e3b58b78f2eefcd7c3386eccc9453 /scripts |
Initial linaro test
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/BACKPORTS/10-apt | 3 | ||||
-rwxr-xr-x | scripts/DEBIAN/20-capabilities | 22 | ||||
-rwxr-xr-x | scripts/GRUB_PC/10-setup | 59 | ||||
-rw-r--r-- | scripts/LINARO/10-apt | 6 | ||||
-rwxr-xr-x | scripts/LINARO/99-cleanup | 13 |
5 files changed, 103 insertions, 0 deletions
diff --git a/scripts/BACKPORTS/10-apt b/scripts/BACKPORTS/10-apt new file mode 100755 index 0000000..bdb7a7a --- /dev/null +++ b/scripts/BACKPORTS/10-apt @@ -0,0 +1,3 @@ +#!/bin/bash + +fcopy -M /etc/apt/sources.list.d/backports.list diff --git a/scripts/DEBIAN/20-capabilities b/scripts/DEBIAN/20-capabilities new file mode 100755 index 0000000..ea650fa --- /dev/null +++ b/scripts/DEBIAN/20-capabilities @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Capabilities get lost when creating the fai base.tar.xz image. +# Restore them here. +# + +set -e + +if [ ! -x $target/sbin/setcap ] ; then + exit 0 +fi + +for FILE in /bin/ping /bin/ping6 /usr/bin/fping /usr/bin/fping6; do + if [ -x $target/$FILE -a ! -h $target/$FILE ] ; then + if $ROOTCMD /sbin/setcap cap_net_raw+ep $FILE; then + echo "Setcap worked! $FILE is not suid!" + fi + fi +done +if [ -x $target/usr/bin/systemd-detect-virt ] ; then + $ROOTCMD /sbin/setcap cap_dac_override,cap_sys_ptrace+ep /usr/bin/systemd-detect-virt +fi diff --git a/scripts/GRUB_PC/10-setup b/scripts/GRUB_PC/10-setup new file mode 100755 index 0000000..7a04760 --- /dev/null +++ b/scripts/GRUB_PC/10-setup @@ -0,0 +1,59 @@ +#! /bin/bash +# support for GRUB version 2 + +error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code + +set -a + +# do not set up grub during dirinstall +if [ "$FAI_ACTION" = "dirinstall" ] ; then + exit 0 +fi +# during softupdate use this file +[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh + +if [ -z "$BOOT_DEVICE" ]; then + exit 189 +fi + +# disable os-prober because of #788062 +ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true' + +# skip the rest, if not an initial installation +if [ $FAI_ACTION != "install" ]; then + $ROOTCMD update-grub + exit $error +fi + +$ROOTCMD grub-mkdevicemap --no-floppy +GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE) + + +# Check if RAID is used for the boot device +if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then + raiddev=${BOOT_DEVICE#/dev/} + # install grub on all members of RAID + for device in `LC_ALL=C perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat`; do + echo Install grub on /dev/$device + $ROOTCMD grub-install --no-floppy "/dev/$device" + done + +elif [[ $GROOT =~ 'hostdisk' ]]; then + cat > $target/boot/grub/device.map <<EOF +(hd0) $BOOT_DEVICE +EOF + $ROOTCMD grub-install --no-floppy --modules=part_msdos $BOOT_DEVICE + if [ $? -eq 0 ]; then + echo "Grub installed on hostdisk $BOOT_DEVICE" + fi + rm $target/boot/grub/device.map + +else + $ROOTCMD grub-install --no-floppy "$GROOT" + if [ $? -eq 0 ]; then + echo "Grub installed on $BOOT_DEVICE = $GROOT" + fi +fi +$ROOTCMD update-grub + +exit $error diff --git a/scripts/LINARO/10-apt b/scripts/LINARO/10-apt new file mode 100644 index 0000000..4064d65 --- /dev/null +++ b/scripts/LINARO/10-apt @@ -0,0 +1,6 @@ +#!/bin/sh + +fcopy -M /etc/apt/sources.list.d/linaro.list +fcopy -M /etc/apt/apt.conf.d/linaro.conf + + diff --git a/scripts/LINARO/99-cleanup b/scripts/LINARO/99-cleanup new file mode 100755 index 0000000..37e6a03 --- /dev/null +++ b/scripts/LINARO/99-cleanup @@ -0,0 +1,13 @@ +#! /bin/bash + +rm -f $target/etc/resolv.conf \ + $target/etc/udev/rules.d/70-persistent-net.rules \ + $target/lib/udev/write_net_rules \ + $target/etc/mailname \ + $target/etc/machine-id \ + $target/var/lib/dbus/machine-id + +touch $target/etc/machine-id + +shred --remove $target/etc/ssh/ssh_host_* + |