Skip to content

Commit

Permalink
fix: ama0 mender problem
Browse files Browse the repository at this point in the history
update: WPA_COUNTRY

feature: menderize added

Update Dockerfile

Revert "Update Dockerfile"

This reverts commit 44edfed.

feature: add nmap package

feature: added menderize script

git: add mender_work to gitignore

update: menderize script fixed and added to readme

fix: menderize

Revert "feature: menderize added"

This reverts commit 0b0b559.

update: add build mendercontainer

fix: chmod changed

update: motd sudo ping

update: motd

update: added leaflet cli to image

fix: remove sudo from motd

update: remove ping from motd

fix: typo in ssh command

fix: ssh folder

refactor: mende_work to dockerignore

feature: Nymea stage with updated nymea package list

update: menderize script

Customized mender.conf creation script is now used

refactor: motd

fix: package list is now updated after new repos are added

feature: update nymea

added nymea experimental repo and updated packagelist

feature: syslog forward deactivted

journalctl will no longer forward logs to syslog(safes discspace)

feature: leaflet-hotspot manager added

feature: Img Version number added

feature: menderize exit codes

added return errors to exits in script

fix: naming

feature: moved menderize script to Imagebuilder

feature: identity added

feature: add Image Version to motd

refactor: img name changed

feature: InstalledPackages.list added

update: version string

feature: motd update

feature: leaflet.info added

feature: filename changed

feature: added IMG_VERSION as input for build.sh

refactor: added comments

feature: added image version

reafactor: removed breaking comments

fix: leaflet.info added

Update release notes

Added PIGEN_DOCKER_OPTS to  build-docker.sh (RPi-Distro#521)

Update Beginner's Guide download link

Added simple catch for default case in which PIGEN_DOCKER_OPTS is unspecified during docker build (RPi-Distro#522)

Fix: update dependencies (RPi-Distro#526)

Copy debootstrap.log on failure

Fix broken imagetool.sh --mount (RPi-Distro#529)

fix: leaflet.info

feature: image name updated

Revert "feature: image name updated"

This reverts commit e436240.

update: imgname in config

refactor: commented

feature: moved package list to own stage

feature: updated Image Info file

update: info and releaseontes

fix: finalize stage

feature: added wifi ip to hotspot settings

refactor: motd.sh

feature: leaf user no password

refactor: convert Image version format in info file

ci: removed gitlab yml

feature: leaflet-hotspot now shows more status info

fix: removed various bugs in Hotspot script

docs: update release notes

update: .info file updated

ci: Info file update

feature: added openvpn package

feature: network settings to data partition

fix: fix local config for leaflet hotspot

fix: typo in hotspot

feature: hotspot now has last 4 digits of serial number

feature: networkmanager WIFI only if password was set

feature:  add hostname change to hotspot tool

feature: hostname and hotspot refactor

refactor: updated Hotspot and Network stage

feature: leaflet-configure added

feauter: leaflet-configure fixed

fix: motd not using base software anymore

feature: added python pip3 package

feature: skipping nymea stage

fix: leaflet-wizzard password to json

fix: change owner of .ssh folder

feature: added network manager

feature: purge conflicts with network manager

fixed: hotspot service after network manager

remove: root password

feature: remove leaf user, only ssh key

fix: removed SKIPs

feature: no hotspot at default

feature: leaflet-network

Leaflet-hotpsot is now named leaflet-network and holds options for wired connection

fix: typo in leaflet-network

feature: hems and cems test

fix: typo

feature: update nymea package list

feature: added cems stage

update .info file

update leaflet-network to 0.2

feature: added live repo
  • Loading branch information
Alexander Pietsch committed Jan 27, 2022
1 parent 4fa4182 commit 883071d
Show file tree
Hide file tree
Showing 50 changed files with 1,177 additions and 229 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ work/
deploy/
apt-cacher-ng/
.git/objects/*
mender_work/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ postrun.sh
.pc
*-pc
apt-cacher-ng/
mender_work/
27 changes: 0 additions & 27 deletions .gitlab-ci.yml

This file was deleted.

4 changes: 4 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ case "$(uname -m)" in
esac
${DOCKER} build --build-arg BASE_IMAGE=${BASE_IMAGE} -t pi-gen "${DIR}"

#A.Pietsch: added -e "IMG_VERSION=${IMG_VERSION}"\
if [ "${CONTAINER_EXISTS}" != "" ]; then
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM
time ${DOCKER} run --rm --privileged \
Expand All @@ -95,6 +96,7 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then
${PIGEN_DOCKER_OPTS} \
--volume "${CONFIG_FILE}":/config:ro \
-e "GIT_HASH=${GIT_HASH}" \
-e "IMG_VERSION=${IMG_VERSION}"\
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
Expand All @@ -103,13 +105,15 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then
wait "$!"
else
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM
#A.Pietsch: added -e "IMG_VERSION=${IMG_VERSION}"\
time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \
--cap-add=ALL \
-v /dev:/dev \
-v /lib/modules:/lib/modules \
${PIGEN_DOCKER_OPTS} \
--volume "${CONFIG_FILE}":/config:ro \
-e "GIT_HASH=${GIT_HASH}" \
-e "IMG_VERSION=${IMG_VERSION}"\
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
Expand Down
12 changes: 10 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,17 @@ if [ -z "${IMG_NAME}" ]; then
exit 1
fi

# A.Pietsch: Added IMG_VERSION as mandatory Input parameter
if [ -z "${IMG_VERSION}" ]; then
echo "IMG_VERSION not set" 1>&2
exit 1
fi

export USE_QEMU="${USE_QEMU:-0}"
export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}"
export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}"}"
export ZIP_FILENAME="${ZIP_FILENAME:-"image_${IMG_DATE}-${IMG_NAME}"}"
# A.Pietsch: Changed IMGfilename
export IMG_FILENAME="${IMG_FILENAME:-"${IMG_NAME}-${IMG_VERSION}"}"
export ZIP_FILENAME="${ZIP_FILENAME:-"${IMG_NAME}-${IMG_VERSION}"}"

export SCRIPT_DIR="${BASE_DIR}/scripts"
export WORK_DIR="${WORK_DIR:-"${BASE_DIR}/work/${IMG_NAME}"}"
Expand Down Expand Up @@ -228,6 +235,7 @@ export PUBKEY_SSH_FIRST_USER
export CLEAN
export IMG_NAME
export APT_PROXY
export IMG_VERSION

export STAGE
export STAGE_DIR
Expand Down
4 changes: 2 additions & 2 deletions config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
IMG_NAME=consolinno-buster
IMG_NAME=leafletpi_cems
FIRST_USER_NAME="leaf"
FIRST_USER_PASS="leaflet"
TARGET_HOSTNAME="leaflet"
ENABLE_SSH=1
WPA_COUNTRY=GB
WPA_COUNTRY=DE


25 changes: 10 additions & 15 deletions export-image/04-finalise/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,21 @@ rm -f "${ROOTFS_DIR}/etc/vnc/updateid"
update_issue "$(basename "${EXPORT_DIR}")"
install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt"

cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"


# A. Pietsch: modified info file
#cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
{
if [ -f "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" ]; then
firmware=$(zgrep "firmware as of" \
"$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \
head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p')
printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware"

# A. Pietsch: modified info file
printf "Consolinno Energy Leaflet Base Image\n\n"
printf "Image Name: ${IMG_FILENAME}\n"
printf "Hostname: ${TARGET_HOSTNAME}\n"

kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")"
printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel"
} >> "$INFO_FILE"

uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")"
printf "Uname string: %s\n" "$uname"
fi
# A.Pietsch: Add info about kernel and packages
cat ${ROOTFS_DIR}/etc/leafletimage.info >> "$INFO_FILE"

printf "\nPackages:\n"
dpkg -l --root "$ROOTFS_DIR"
} >> "$INFO_FILE"

mkdir -p "${DEPLOY_DIR}"

Expand Down
16 changes: 16 additions & 0 deletions release-notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
2021-10-06:
* Added Config Wizzard
* Updated Hotspot Tool
* Changed Motd

2021-09-08:
* Updated Hotspot Tool
* Changed Motd

2021-08-02:
* Consolinno Stage added
* Nymea Stage added
* Leaflet Hotspot added
* Leaflet Pi Kernel 5.4. added
* Sc16is752 Overlay added

15 changes: 8 additions & 7 deletions stage1/01-sys-tweaks/00-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ install -d "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d"
install -m 644 files/noclear.conf "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d/noclear.conf"
install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab"

on_chroot << EOF
if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
fi
echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd
echo "root:root" | chpasswd
EOF
#A.Pietsch: remove First User
# on_chroot << EOF
# if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then
# adduser --disabled-password --gecos "" ${FIRST_USER_NAME}
# fi
# echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd
# #echo "root:root" | chpasswd
# EOF


17 changes: 9 additions & 8 deletions stage2/01-sys-tweaks/01-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ systemctl enable resize2fs_once
EOF
fi

on_chroot <<EOF
for GRP in input spi i2c gpio; do
groupadd -f -r "\$GRP"
done
for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev render; do
adduser $FIRST_USER_NAME \$GRP
done
EOF
# a.Pietsch: remove First User
# on_chroot <<EOF
# for GRP in input spi i2c gpio; do
# groupadd -f -r "\$GRP"
# done
# for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev; do
# adduser $FIRST_USER_NAME \$GRP
# done
# EOF

on_chroot << EOF
setupcon --force --save-only -v
Expand Down
6 changes: 4 additions & 2 deletions stage2/04-consolinno/00-run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash -e
install -m 755 files/motd.sh "${ROOTFS_DIR}/etc/profile.d/"

install -m 755 files/01_motd.sh "${ROOTFS_DIR}/etc/profile.d/"
install -m 755 files/lpi-identity.sh "${ROOTFS_DIR}/usr/bin/"
mkdir ${ROOTFS_DIR}/etc/leaflet/
install -m 755 files/leaflet.info "${ROOTFS_DIR}/etc/leaflet/"
78 changes: 39 additions & 39 deletions stage2/04-consolinno/01-run-chroot.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
#!/bin/bash -e




# Add nymea repository
echo -e "\n## nymea repo\ndeb http://repository.nymea.io buster rpi\n#deb-src http://repository.nymea.io buster rpi" | tee /etc/apt/sources.list.d/nymea.list
wget -qO - http://repository.nymea.io/repository-pubkey.gpg | apt-key add -

# Add consolinno repository
echo -e "\n## leaflet repo\ndeb http://repo.services.consolinno.de buster main\n#deb-src http://repo.services.consolinno.de buster main" | tee /etc/apt/sources.list.d/consolinno.list
wget -qO - http://repo.services.consolinno.de/repo_signing.key | apt-key add -

# Set repository priority (prefer packages from raspbian section)
cat <<EOM >/etc/apt/preferences.d/nymea
Package: *
Pin: release c=raspbian
Pin-Priority: 700
Package: *
Pin: origin repository.nymea.io c=main
Pin-Priority: 500
cat <<EOM > /etc/apt/sources.list.d/consolinno.list
# leaflet repos
deb https://repo.services.consolinno.de buster main
deb https://repo.services.consolinno.de/live buster main
EOM

apt-get update
wget -qO - http://repo.services.consolinno.de/repo_signing.key | apt-key add -

# Update package list
apt update

cat <<EOM > /etc/motd
# empty default motd (replaced by motd.sh)
cat <<EOM > /etc/motd
EOM


# Update maschine Info
cat <<EOM > /etc/machine-info
PRETTY_HOSTNAME=leaflet
EOM

# Update issue.net
cat <<EOM > /etc/issue.net
leaflet - consolinno.de | Debian GNU/Linux 10
EOM
Expand All @@ -39,32 +30,41 @@ cat <<EOM > /etc/issue
leaflet - consolinno.de | Debian GNU/Linux 10 \n \l
EOM

# Stop journal.d to syslog forward
echo -e "ForwardToSyslog=no" >> /etc/systemd/journald.conf

# Reduce write/read operations on Pi
echo -e "tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0"\
>> /etc/fstab

echo -e "tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0" \
>> /etc/fstab

echo -e "#uncomment if needed\n#tmpfs /var/log tmpfs "\
" defaults,noatime,nosuid,size=20m 0 0" >> /etc/fstab

# Activate Watchdog
echo -e "RuntimeWatchdogSec=30s" >> /etc/systemd/system.conf

# Generate SSH Key
mkdir -p /root/.ssh/

# Drop packages conflicting with network-manager
apt-get purge --yes openresolv dhcpcd5

# # Disable BlueZ plugins QtBluetooth can't deal with
# mkdir /etc/systemd/system/bluetooth.service.d
# cat <<EOM > /etc/systemd/system/bluetooth.service.d/01-disable-battery-plugin.conf
# [Service]
# ExecStart=
# ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=battery,sap
# EOM

# FS TAB
echo -e "tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0" >> /etc/fstab
echo -e "tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0" >> /etc/fstab
echo -e "#uncomment if needed\n#tmpfs /var/log tmpfs defaults,noatime,nosuid,size=20m 0 0" >> /etc/fstab
ssh-keygen -q -f /root/.ssh/id_rsa -N "" \
-C "root@${TARGET_HOSTNAME}"


# Convert filename version x_x_x to x.x.x and store in Info
LPI_IMG_VERSION=$(echo "${IMG_VERSION}" | sed -e 's/_/\./g')
echo -e "LPI_IMG_VERSION=${LPI_IMG_VERSION}" >> /etc/leaflet/leaflet.info

# WATCHDOG
echo -e "RuntimeWatchdogSec=30s" >> /etc/systemd/system.conf
# Make First user use no sudo password
# touch /etc/sudoers.d/010_${FIRST_USER_NAME}-nopasswd
# echo -e "${FIRST_USER_NAME} ALL=(ALL) NOPASSWD: ALL" >> \
# /etc/sudoers.d/010_${FIRST_USER_NAME}-nopasswd

# ssh key only
sed -i -Ee 's/^#?[[:blank:]]*PubkeyAuthentication[[:blank:]]*no[[:blank:]]*$/PubkeyAuthentication yes/
s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' /etc/ssh/sshd_config

#MBUS TOOLS, CLI
# Drop packages conflicting with network-manager
apt-get purge --yes openresolv dhcpcd5
12 changes: 8 additions & 4 deletions stage2/04-consolinno/02-packages
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
nymea
nymea-plugins
nymea-networkmanager
leafletbs-app
leafletbs-cli
vim
modpoll

nmap
i2c-tools
jq
openvpn
gpiod
python3-pip
network-manager
Loading

0 comments on commit 883071d

Please sign in to comment.