Fixing firstboot script issues

parent 2df991d0
Pipeline #230 passed with stages
......@@ -20,7 +20,7 @@ CONFIGFILE=$(IMAGEPREFIX).config.tar.bz2
LISTFILE=$(IMAGEPREFIX).contents
CHROOTFILE=$(IMAGEPREFIX).files
PKGSFILE=$(IMAGEPREFIX).packages
TARGZFILE=$(IMAGEPREFIX).tar.gz
TARFILE=$(IMAGEPREFIX).tar
MD5SUMSFILE=$(IMAGEPREFIX).md5sums.txt
SHA1SUMSFILE=$(IMAGEPREFIX).sha1sums.txt
IMAGENAME=$(IMAGEPREFIX).img
......@@ -41,9 +41,9 @@ all:
sudo mv live-image-armhf.contents $(LISTFILE); \
sudo mv chroot.files $(CHROOTFILE); \
sudo mv chroot.packages.install $(PKGSFILE); \
sudo mv live-image-armhf.tar.tar.gz $(TARGZFILE); \
md5sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARGZFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARGZFILE) > $(SHA1SUMSFILE); \
sudo mv live-image-armhf.tar.tar $(TARFILE); \
md5sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARFILE) > $(SHA1SUMSFILE); \
set -e; sudo ./build_parrotsec_image.sh 2>&1 | tee $(LOGFILEIMG); \
fi
......@@ -74,9 +74,9 @@ all_gitlabci:
sudo mv live-image-armhf.contents $(LISTFILE); \
sudo mv chroot.files $(CHROOTFILE); \
sudo mv chroot.packages.install $(PKGSFILE); \
sudo mv live-image-armhf.tar.tar.gz $(TARGZFILE); \
md5sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARGZFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARGZFILE) > $(SHA1SUMSFILE); \
sudo mv live-image-armhf.tar.tar $(TARFILE); \
md5sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARFILE) > $(SHA1SUMSFILE); \
set -e; sudo ./build_parrotsec_image_CI.sh 2>&1 | tee $(LOGFILEIMG); \
fi
......@@ -102,12 +102,12 @@ finalize:
sudo mv live-image-armhf.contents $(LISTFILE); \
sudo mv chroot.files $(CHROOTFILE); \
sudo mv chroot.packages.install $(PKGSFILE); \
sudo mv live-image-armhf.tar.tar.gz $(TARGZFILE); \
md5sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARGZFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARGZFILE) > $(SHA1SUMSFILE); \
sudo mv live-image-armhf.tar.tar $(TARFILE); \
md5sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARFILE) > $(MD5SUMSFILE); \
sha1sum $(LOGFILE) $(CONFIGFILE) $(LISTFILE) $(CHROOTFILE) $(PKGSFILE) $(TARFILE) > $(SHA1SUMSFILE); \
fi
if [ ! -f $(TARGZFILE) ]; then \
if [ ! -f $(TARFILE) ]; then \
echo "Error!!! Something went wrong, check the logs please"; \
exit 1; \
fi
......
......@@ -176,7 +176,7 @@ sleep 5
echo "Unpacking rootfs tarball"
tar xpzf ${absolute_path}/parrotsec-*.tar.gz --transform 's,binary,.,' --show-transformed -C ${rootfs}/
tar xpf ${absolute_path}/parrotsec-*.tar --transform 's,binary,.,' --show-transformed -C ${rootfs}/
ls ${rootfs}/
......
......@@ -183,7 +183,7 @@ sleep 5
echo "Unpacking rootfs tarball"
tar xpzf ${absolute_path}/parrotsec-*.tar.gz --transform 's,binary,.,' --show-transformed -C ${rootfs}/
tar xpf ${absolute_path}/parrotsec-*.tar --transform 's,binary,.,' --show-transformed -C ${rootfs}/
ls ${rootfs}/
......
......@@ -5,7 +5,6 @@ rm -rf /etc/systemd/system/autologin@.service || true
systemctl enable hciattach.service
systemctl enable firstboot.service
systemctl disable nilfs_cleanerd.service
# Ensure that ssh daemon is enabled
......
......@@ -11,16 +11,20 @@ Type=oneshot
# Comment this lines if you don't want autoresize of rootfs
# For ext4 rootfs
#ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && resize2fs /dev/mmcblk0p2"
#ExecStart=/usr/bin/growpart /dev/mmcblk0 2
#ExecStart=resize2fs /dev/mmcblk0p2
# For xfs rootfs
#ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && /usr/sbin/xfs_growfs -d /"
#ExecStart=/usr/bin/growpart /dev/mmcblk0 2
#ExecStart=/usr/sbin/xfs_growfs -d /
# For nilfs
#ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && /usr/sbin/nilfs-resize -y /dev/mmcblk0p2"
#ExecStart=/usr/bin/growpart /dev/mmcblk0 2
#ExecStart=/usr/sbin/nilfs-resize -y /dev/mmcblk0p2
# For btrfs
ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && /bin/btrfs filesystem resize max /"
ExecStart=/usr/bin/growpart /dev/mmcblk0 2
ExecStart=/bin/btrfs filesystem resize max /
# Creating new machine-id
ExecStart=/bin/systemd-machine-id-setup
......@@ -28,10 +32,14 @@ ExecStart=/bin/systemd-machine-id-setup
# Regenerating ssh keys and reboot. This should have been done by the regenerate_ssh_host_keys.service from rpi packages, on presence of /boot/ssh.
# We ensure that even if there isn't, we regent the keys
ExecStart=/bin/sh -c "/bin/dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096 && /bin/rm -f -v /etc/ssh/ssh_host_*_key* || true; /usr/bin/ssh-keygen -A -v"
ExecStart=/bin/dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096
ExecStart=/bin/rm -f -v /etc/ssh/ssh_host_*_key*
ExecStart=/usr/bin/ssh-keygen -A -v
# Enable firewall service and opening ssh port, not working at the moment due to incompatible versions ufw <-> iptables
ExecStart=/bin/sh -c "/usr/sbin/ufw --force enable && /usr/sbin/ufw allow ssh && /bin/systemctl enable ufw.service"
ExecStart=/usr/sbin/ufw --force enable
ExecStart=/usr/sbin/ufw allow ssh
ExecStart=/bin/systemctl enable ufw.service
# Be aggressive, we don't want graphical login before rebooting
ExecStart=/bin/systemctl --force --force reboot
......
......@@ -5,7 +5,6 @@ rm -rf /etc/systemd/system/autologin@.service || true
systemctl enable hciattach.service
systemctl enable firstboot.service
systemctl disable nilfs_cleanerd.service
# Ensure that ssh daemon is enabled
......
......@@ -11,16 +11,20 @@ Type=oneshot
# Comment this lines if you don't want autoresize of rootfs
# For ext4 rootfs
#ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && resize2fs /dev/mmcblk0p2"
#ExecStart=/usr/bin/growpart /dev/mmcblk0 2
#ExecStart=resize2fs /dev/mmcblk0p2
# For xfs rootfs
#ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && /usr/sbin/xfs_growfs -d /"
#ExecStart=/usr/bin/growpart /dev/mmcblk0 2
#ExecStart=/usr/sbin/xfs_growfs -d /
# For nilfs
#ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && /usr/sbin/nilfs-resize -y /dev/mmcblk0p2"
#ExecStart=/usr/bin/growpart /dev/mmcblk0 2
#ExecStart=/usr/sbin/nilfs-resize -y /dev/mmcblk0p2
# For btrfs
ExecStartPre=/bin/sh -c "/usr/bin/growpart /dev/mmcblk0 2 && /bin/btrfs filesystem resize max /"
ExecStart=/usr/bin/growpart /dev/mmcblk0 2
ExecStart=/bin/btrfs filesystem resize max /
# Creating new machine-id
ExecStart=/bin/systemd-machine-id-setup
......@@ -28,10 +32,14 @@ ExecStart=/bin/systemd-machine-id-setup
# Regenerating ssh keys and reboot. This should have been done by the regenerate_ssh_host_keys.service from rpi packages, on presence of /boot/ssh.
# We ensure that even if there isn't, we regent the keys
ExecStart=/bin/sh -c "/bin/dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096 && /bin/rm -f -v /etc/ssh/ssh_host_*_key* || true; /usr/bin/ssh-keygen -A -v"
ExecStart=/bin/dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096
ExecStart=/bin/rm -f -v /etc/ssh/ssh_host_*_key*
ExecStart=/usr/bin/ssh-keygen -A -v
# Enable firewall service and opening ssh port, not working at the moment due to incompatible versions ufw <-> iptables
ExecStart=/bin/sh -c "/usr/sbin/ufw --force enable && /usr/sbin/ufw allow ssh && /bin/systemctl enable ufw.service"
ExecStart=/usr/sbin/ufw --force enable
ExecStart=/usr/sbin/ufw allow ssh
ExecStart=/bin/systemctl enable ufw.service
# Be aggressive, we don't want graphical login before rebooting
ExecStart=/bin/systemctl --force --force reboot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment