2018-03-08 17:53:23 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2019-02-18 12:09:04 +00:00
|
|
|
# Avahi and mysql/mariadb needs to do some stuff which conflicts with
|
|
|
|
# the "change the root password asap" so we disable it. In fact, now
|
|
|
|
# that YunoHost 3.3 syncs the password with admin password at
|
|
|
|
# postinstall we are happy with not triggering a password change at
|
|
|
|
# first boot. Assuming that ARM-boards won't be exposed to global
|
|
|
|
# network right after booting the first time ...
|
|
|
|
on_chroot << EOF
|
|
|
|
chage -d 99999999 root
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Run the actual install
|
2018-03-08 17:53:23 +00:00
|
|
|
on_chroot << EOF
|
2018-04-03 14:02:23 +00:00
|
|
|
apt-get install insserv -y
|
2019-02-18 12:09:04 +00:00
|
|
|
curl https://install.yunohost.org/stretch | bash -s -- -a
|
2018-04-02 17:15:23 +00:00
|
|
|
rm -f /etc/ssh/ssh_host_*
|
2018-04-03 14:02:23 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
echo "Enabling ssh login for root + setting default password"
|
|
|
|
on_chroot << EOF
|
2018-04-02 22:46:09 +00:00
|
|
|
touch /boot/ssh
|
|
|
|
sed -i '/PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config
|
|
|
|
echo "root:yunohost" | chpasswd
|
2018-03-08 17:53:23 +00:00
|
|
|
EOF
|
2018-04-03 14:02:23 +00:00
|
|
|
|
2018-05-09 00:34:02 +00:00
|
|
|
install -m 755 files/check_yunohost_is_installed.sh "${ROOTFS_DIR}/etc/profile.d/"
|
|
|
|
|
2018-04-03 14:02:23 +00:00
|
|
|
echo "Cleaning ..."
|
|
|
|
on_chroot << EOF
|
|
|
|
apt-get clean
|
|
|
|
find /var/log -type f -exec rm {} \;
|
|
|
|
EOF
|
2018-04-03 14:03:36 +00:00
|
|
|
|
|
|
|
# Gotta manually kill those stuff which are some sort of daemon running
|
|
|
|
# for slapd / nscd / nslcd ... otherwise the script is unable to unmount
|
|
|
|
# the rootfs/image after that ?
|
2019-02-18 12:09:04 +00:00
|
|
|
while lsof 2>/dev/null | grep -q /root/rpi-image/work/*/export-image/rootfs/dev;
|
|
|
|
do
|
|
|
|
for PID in `ps -ef --forest | grep "qemu-arm-static" | grep -v "grep" | grep "nginx\|nscd\|slapd\|nslcd" | awk '{print $2}'`
|
|
|
|
do
|
|
|
|
echo "Killing $PID"
|
|
|
|
kill -9 $PID || true
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
while ps -ef --forest | grep "qemu-arm-static" | grep -v "grep"
|
2018-04-03 14:03:36 +00:00
|
|
|
do
|
2019-02-18 12:09:04 +00:00
|
|
|
for PID in `ps -ef --forest | grep "qemu-arm-static" | grep -v "grep" | grep "nginx\|nscd\|slapd\|nslcd" | awk '{print $2}'`
|
|
|
|
do
|
2018-04-07 20:53:07 +00:00
|
|
|
echo "Killing $PID"
|
2019-02-18 12:09:04 +00:00
|
|
|
kill -9 $PID || true
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
sleep 5
|
2018-04-03 14:03:36 +00:00
|
|
|
done
|