Fix dots and typos
This commit is contained in:
62
riotboard.sh
62
riotboard.sh
@@ -20,11 +20,11 @@ fi
|
||||
|
||||
# Architecture
|
||||
architecture=${architecture:-"arm64"}
|
||||
# Generate a random machine name to be used.
|
||||
# Generate a random machine name to be used
|
||||
machine=$(tr -cd 'A-Za-z0-9' < /dev/urandom | head -c16 ; echo)
|
||||
# Custom hostname variable
|
||||
hostname=${2:-kali}
|
||||
# Custom image file name variable - MUST NOT include .img at the end.
|
||||
# Custom image file name variable - MUST NOT include .img at the end
|
||||
imagename=${3:-kali-linux-$1-riot}
|
||||
# Suite to use, valid options are:
|
||||
# kali-rolling, kali-dev, kali-bleeding-edge, kali-dev-only, kali-experimental, kali-last-snapshot
|
||||
@@ -37,14 +37,14 @@ bootsize="128"
|
||||
compress="xz"
|
||||
# Choose filesystem format to format ( ext3 or ext4 )
|
||||
fstype="ext3"
|
||||
# If you have your own preferred mirrors, set them here.
|
||||
# If you have your own preferred mirrors, set them here
|
||||
mirror=${mirror:-"http://http.kali.org/kali"}
|
||||
# Gitlab url Kali repository
|
||||
kaligit="https://gitlab.com/kalilinux"
|
||||
# Github raw url
|
||||
githubraw="https://raw.githubusercontent.com"
|
||||
|
||||
# Check EUID=0 you can run any binary as root.
|
||||
# Check EUID=0 you can run any binary as root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root or have super user permissions"
|
||||
echo "Use: sudo $0 ${1:-2.0} ${2:-kali}"
|
||||
@@ -57,7 +57,7 @@ if [[ $# -eq 0 ]] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check exist bsp directory.
|
||||
# Check exist bsp directory
|
||||
if [ ! -e "bsp" ]; then
|
||||
echo "Error: missing bsp directory structure"
|
||||
echo "Please clone the full repository ${kaligit}/build-scripts/kali-arm"
|
||||
@@ -86,7 +86,7 @@ fi
|
||||
components="main,contrib,non-free"
|
||||
# Don't add the kernel here. It depends on flash-kernel which in turn will fail
|
||||
# when building on amd64, instead we fake a uname/architecture further down and
|
||||
# actually install the kernel package after compiling it.
|
||||
# actually install the kernel package after compiling it
|
||||
arm="kali-linux-arm ntpdate"
|
||||
base="apt-transport-https apt-utils bash-completion console-setup dialog e2fsprogs ifupdown initramfs-tools inxi iw man-db mlocate netcat-traditional net-tools parted pciutils psmisc rfkill screen tmux unrar usbutils vim wget whiptail zerofree"
|
||||
desktop="kali-desktop-xfce kali-root-login xserver-xorg-video-fbdev xfonts-terminus xinput"
|
||||
@@ -96,10 +96,10 @@ extras="alsa-utils bc bison bluez bluez-firmware kali-linux-core libnss-systemd
|
||||
|
||||
packages="${arm} ${base} ${services}"
|
||||
|
||||
# Automatic configuration to use an http proxy, such as apt-cacher-ng.
|
||||
# You can turn off automatic settings by uncommenting apt_cacher=off.
|
||||
# Automatic configuration to use an http proxy, such as apt-cacher-ng
|
||||
# You can turn off automatic settings by uncommenting apt_cacher=off
|
||||
# apt_cacher=off
|
||||
# By default the proxy settings are local, but you can define an external proxy.
|
||||
# By default the proxy settings are local, but you can define an external proxy
|
||||
# proxy_url="http://external.intranet.local"
|
||||
apt_cacher=${apt_cacher:-"$(lsof -i :3142|cut -d ' ' -f3 | uniq | sed '/^\s*$/d')"}
|
||||
if [ -n "$proxy_url" ]; then
|
||||
@@ -123,16 +123,16 @@ elif [[ "${architecture}" == "armel" ]]; then
|
||||
lib_arch="arm-linux-gnueabi"
|
||||
fi
|
||||
|
||||
# create the rootfs - not much to modify here, except maybe throw in some more packages if you want.
|
||||
# create the rootfs - not much to modify here, except maybe throw in some more packages if you want
|
||||
eatmydata debootstrap --foreign --keyring=/usr/share/keyrings/kali-archive-keyring.gpg --include=kali-archive-keyring,eatmydata \
|
||||
--components=${components} --arch ${architecture} ${suite} ${work_dir} http://http.kali.org/kali
|
||||
|
||||
# systemd-nspawn enviroment
|
||||
# systemd-nspawn environment
|
||||
systemd-nspawn_exec(){
|
||||
LANG=C systemd-nspawn -q --bind-ro ${qemu_bin} -M ${machine} -D ${work_dir} "$@"
|
||||
}
|
||||
|
||||
# We need to manually extract eatmydata to use it for the second stage.
|
||||
# We need to manually extract eatmydata to use it for the second stage
|
||||
for archive in ${work_dir}/var/cache/apt/archives/*eatmydata*.deb; do
|
||||
dpkg-deb --fsys-tarfile "$archive" > ${work_dir}/eatmydata
|
||||
tar -xkf ${work_dir}/eatmydata -C ${work_dir}
|
||||
@@ -196,18 +196,18 @@ EOF
|
||||
# DNS server
|
||||
echo "nameserver 8.8.8.8" > ${work_dir}/etc/resolv.conf
|
||||
|
||||
# Copy directory bsp into build dir.
|
||||
# Copy directory bsp into build dir
|
||||
cp -rp bsp ${work_dir}
|
||||
|
||||
export MALLOC_CHECK_=0 # workaround for LP: #520465
|
||||
|
||||
# Enable the use of http proxy in third-stage in case it is enabled.
|
||||
# Enable the use of http proxy in third-stage in case it is enabled
|
||||
if [ -n "$proxy_url" ]; then
|
||||
echo "Acquire::http { Proxy \"$proxy_url\" };" > ${work_dir}/etc/apt/apt.conf.d/66proxy
|
||||
fi
|
||||
|
||||
|
||||
# Fake a uname response so that flash-kernel doesn't bomb out.
|
||||
# Fake a uname response so that flash-kernel doesn't bomb out
|
||||
cat << 'EOF' > ${work_dir}/root/fakeuname.c
|
||||
#define _GNU_SOURCE
|
||||
#include <unistd.h>
|
||||
@@ -238,12 +238,12 @@ eatmydata apt-get update
|
||||
|
||||
eatmydata apt-get -y install binutils ca-certificates console-common git initramfs-tools less locales nano u-boot-tools
|
||||
|
||||
# Create kali user with kali password... but first, we need to manually make some groups because they don't yet exist...
|
||||
# This mirrors what we have on a pre-installed VM, until the script works properly to allow end users to set up their own... user.
|
||||
# Create kali user with kali password... but first, we need to manually make some groups because they don't yet exist..
|
||||
# This mirrors what we have on a pre-installed VM, until the script works properly to allow end users to set up their own... user
|
||||
# However we leave off floppy, because who a) still uses them, and b) attaches them to an SBC!?
|
||||
# And since a lot of these have serial devices of some sort, dialout is added as well.
|
||||
# And since a lot of these have serial devices of some sort, dialout is added as well
|
||||
# scanner, lpadmin and bluetooth have to be added manually because they don't
|
||||
# yet exist in /etc/group at this point.
|
||||
# yet exist in /etc/group at this point
|
||||
groupadd -r -g 118 bluetooth
|
||||
groupadd -r -g 113 lpadmin
|
||||
groupadd -r -g 122 scanner
|
||||
@@ -255,7 +255,7 @@ echo "kali:kali" | chpasswd
|
||||
aptops="--allow-change-held-packages -o dpkg::options::=--force-confnew -o Acquire::Retries=3"
|
||||
|
||||
# This looks weird, but we do it twice because every so often, there's a failure to download from the mirror
|
||||
# So to workaround it, we attempt to install them twice.
|
||||
# So to workaround it, we attempt to install them twice
|
||||
eatmydata apt-get install -y \$aptops ${packages} || eatmydata apt-get --yes --fix-broken install
|
||||
eatmydata apt-get install -y \$aptops ${packages} || eatmydata apt-get --yes --fix-broken install
|
||||
eatmydata apt-get install -y \$aptops ${desktop} ${extras} ${tools} || eatmydata apt-get --yes --fix-broken install
|
||||
@@ -266,7 +266,7 @@ eatmydata apt-get dist-upgrade -y \$aptops
|
||||
eatmydata apt-get -y --allow-change-held-packages --purge autoremove
|
||||
|
||||
# We do this here, otherwise flash-kernel will fail to run because of not seeing
|
||||
# the proper kernel version.
|
||||
# the proper kernel version
|
||||
cd /root && gcc -Wall -shared -o libfakeuname.so fakeuname.c
|
||||
LD_PRELOAD=/root/libfakeuname.so eatmydata apt-get install -y \$aptops linux-image-armmp u-boot-imx
|
||||
rm /root/libfakeuname*
|
||||
@@ -280,7 +280,7 @@ echo 'console-common console-data/keymap/full select en-latin1-nodeadkeys' | deb
|
||||
cp -p /bsp/services/all/*.service /etc/systemd/system/
|
||||
|
||||
# Regenerated the shared-mime-info database on the first boot
|
||||
# since it fails to do so properly in a chroot.
|
||||
# since it fails to do so properly in a chroot
|
||||
systemctl enable smi-hack
|
||||
|
||||
# Generate SSH host keys on first run
|
||||
@@ -304,7 +304,7 @@ sed -i -e 's/REGDOM.*/REGDOMAIN=00/g' /etc/default/crda
|
||||
echo "T0:23:respawn:/sbin/agetty -L ttymxc1 115200 vt100" >> /etc/inittab
|
||||
|
||||
# Try and make the console a bit nicer
|
||||
# Set the terminus font for a bit nicer display.
|
||||
# Set the terminus font for a bit nicer display
|
||||
sed -i -e 's/FONTFACE=.*/FONTFACE="Terminus"/' /etc/default/console-setup
|
||||
sed -i -e 's/FONTSIZE=.*/FONTSIZE="6x12"/' /etc/default/console-setup
|
||||
|
||||
@@ -341,7 +341,7 @@ for logs in $(find /var/log -type f); do > $logs; done
|
||||
history -c
|
||||
EOF
|
||||
|
||||
# Disable the use of http proxy in case it is enabled.
|
||||
# Disable the use of http proxy in case it is enabled
|
||||
if [ -n "$proxy_url" ]; then
|
||||
unset http_proxy
|
||||
rm -rf ${work_dir}/etc/apt/apt.conf.d/66proxy
|
||||
@@ -363,7 +363,7 @@ EOF
|
||||
|
||||
# systemd doesn't seem to be generating the fstab properly for some people, so
|
||||
# let's create one. The root partition is added below after img file creation
|
||||
# so we can add it via uuid.
|
||||
# so we can add it via uuid
|
||||
cat << EOF > ${work_dir}/etc/fstab
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
@@ -387,7 +387,7 @@ cd "${basedir}"
|
||||
#dd if=u-boot.imx of=$loopdevice bs=1024 seek=1
|
||||
#cd "${basedir}"
|
||||
|
||||
# Generate the bootscript so that u-boot knows where everything is...
|
||||
# Generate the bootscript so that u-boot knows where everything is..
|
||||
#cat << __EOF__ > "${basedir}"/kali-$architecture/boot/bootscript
|
||||
#fdt_high=0xffffffff
|
||||
#initrd_high=0xffffffff
|
||||
@@ -403,7 +403,7 @@ cd "${basedir}"
|
||||
#doboot=part uuid \${dtype} \${disk}:2 btpart ; run bargs; if run loadkernel; then echo kernel_loaded ; if run loadfdt; then echo fdt_loaded; bootz \${loadaddr} - 0x11000000 ; else echo fail1 ; fi ; fi ; echo failed to boot
|
||||
#__EOF__
|
||||
|
||||
# Calculate the space to create the image.
|
||||
# Calculate the space to create the image
|
||||
root_size=$(du -s -B1 ${work_dir} --exclude=${work_dir}/boot | cut -f1)
|
||||
root_extra=$((${root_size}/1024/1000*5*1024/5))
|
||||
raw_size=$(($((${free_space}*1024))+${root_extra}+$((${bootsize}*1024))+4096))
|
||||
@@ -438,12 +438,12 @@ mount ${rootp} "${basedir}"/root
|
||||
mkdir -p "${basedir}"/root/boot
|
||||
mount ${bootp} "${basedir}"/root/boot
|
||||
|
||||
# We do this down here to get rid of the build system's resolv.conf after running through the build.
|
||||
# We do this down here to get rid of the build system's resolv.conf after running through the build
|
||||
cat << EOF > ${work_dir}/etc/resolv.conf
|
||||
nameserver 8.8.8.8
|
||||
EOF
|
||||
|
||||
# Create an fstab so that we don't mount / read-only.
|
||||
# Create an fstab so that we don't mount / read-only
|
||||
UUID=$(blkid -s UUID -o value ${rootp})
|
||||
echo "UUID=$UUID / $fstype errors=remount-ro 0 1" >> ${work_dir}/etc/fstab
|
||||
|
||||
@@ -490,7 +490,7 @@ else
|
||||
chmod 644 ${current_dir}/${imagename}.img
|
||||
fi
|
||||
|
||||
# Clean up all the temporary build stuff and remove the directories.
|
||||
# Comment this out to keep things around if you want to see what may have gone wrong.
|
||||
# Clean up all the temporary build stuff and remove the directories
|
||||
# Comment this out to keep things around if you want to see what may have gone wrong
|
||||
echo "Removing temporary build files"
|
||||
rm -rf "${basedir}"
|
||||
|
||||
Reference in New Issue
Block a user