Skip to content

Instantly share code, notes, and snippets.

View XIIIVI's full-sized avatar

Fabrice TX XIIIVI

View GitHub Profile
@XIIIVI
XIIIVI / systemd-resolved.sh
Created May 5, 2020 09:39
RPI23-gen-image
sudo rm -Rf ./files/firstboot/41-create-resolv-symlink.sh
sudo mv ./files/firstboot/41-create-resolv-symlink.sh ./files/firstboot/41-create-resolv-symlink.sh.original
echo "systemctl enable systemd-resolved.service" | sudo tee -a ./files/firstboot/41-create-resolv-symlink.sh
echo "systemctl restart systemd-resolved.service" | sudo tee -a ./files/firstboot/41-create-resolv-symlink.sh
cat ./files/firstboot/41-create-resolv-symlink.sh.original | sudo tee -a ./files/firstboot/41-create-resolv-symlink.sh
sudo rm -Rf ./files/firstboot/41-create-resolv-symlink.sh.original
cat ./files/firstboot/41-create-resolv-symlink.sh
@XIIIVI
XIIIVI / rpi23-gen-image.exp
Created May 5, 2020 12:49
A launcher for rpi23-gen-image to make it work in silent mode
#!/usr/bin/expect -f
set timeout -1
set TEMPLATE [lindex \$argv 0]
spawn /bin/bash -c "CONFIG_TEMPLATE=\$TEMPLATE ./rpi23-gen-image.sh"
expect {
"*(NEW)*" { send "\r"; exp_continue }
eof
# Load utility functions
. ./functions.sh
cc="${CROSS_COMPILE}gcc"
git clone https://github.com/Infineon/eltt2.git
cd eltt2
make -j$(nproc) ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}"
cd ..
# Load utility functions
. ./functions.sh
<YOUR CODE>
...
# Declaring folders and files
DIR_ETC=${R}/etc/
DIR_BOOT=${R}/
DIR_USR_LOCAL=${R}/usr/local/
DIR_USR_LOCAL_BIN=${DIR_USR_LOCAL}/bin/
...
FILE_RC_LOCAL=${DIR_ETC}/rc.local
FILE_CONFIG_TXT=${DIR_BOOT}/config.txt
...
# Load utility functions
. ./functions.sh
install_exec files/scripts/my_script.sh ${R}/tmp
chroot_exec /tmp/my_script.sh
# Load utility functions
. ./functions.sh
chroot_exec /bin/bash -x << 'EOF_CHROOT'
...
<ALL THE BUILD PROCESS>
...
EOF_CHROOT
...
user_id=$(id -u)
if [ ! "${user_id}" -eq 0 -a -z "$AGENT_ALLOW_RUNASROOT" ]; then
echo "Must run with sudo"
exit 1
fi
...
...
# Defines the colors
GREEN='\033[0;32m'
PURPLE='\033[0;35m'
RED='\033[0;31m'
RESET_COLOR='\033[0m'
YELLOW='\033[0;33m'
WHITE='\033[0;37m'
...
#
# display_help
#
display_help() {
echo "Usage: ${0}.sh --param1 <This is the first parameter>"
echo " --param2 <This is the second parameter>"
echo " --flag1"
echo " [--flag2|flag3 (Default)]"