Skip to content

Commit

Permalink
Merge pull request #26 from machsix/patch
Browse files Browse the repository at this point in the history
fix inconsistent argument, enable swap if needed
  • Loading branch information
Heisath authored Aug 12, 2024
2 parents a39fd8d + 3fd11ed commit eb97abe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ if [[ -z $BUILD_KERNEL ]] && [[ -z $BUILD_ROOTFS ]]; then
[[ $selection == *8* ]] && ZRAM_ENABLED='on'

else # at least kernel or rootfs has been selected via command line, check other options and set defaults
[[ -z $CLEAN_KERNEL_SRC ]] && CLEAN_KERNEL_SRC='on'
[[ -z $CLEAN_KERNEL_SRC ]] && CLEAN_KERNEL_SRC='off'
[[ -z $ALLOW_KERNEL_CONFIG_CHANGES ]] && ALLOW_KERNEL_CONFIG_CHANGES='off'

[[ -z $ALLOW_ROOTFS_CHANGES ]] && ALLOW_ROOTFS_CHANGES='off'
[[ -z $ASK_EXTRA_PKGS ]] && ASK_EXTRA_PKGS='off'
[[ -z $ZRAM_ENABLED ]] && ZRAM_ENABLED='on'
[[ -z $ZRAM_ENABLED ]] && ZRAM_ENABLED='off'
fi


Expand Down
13 changes: 11 additions & 2 deletions inc/rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ EOF
cp -a tweaks/* "${rootfs_dir}"

echo "### Adjusting fstab"
[[ "$BOOT_DEVICE" == 'usb' ]] && chroot "${rootfs_dir}" /bin/bash -c "ln -sf /etc/fstab.usb /etc/fstab"
[[ "$BOOT_DEVICE" == 'hdd' ]] && chroot "${rootfs_dir}" /bin/bash -c "ln -sf /etc/fstab.hdd /etc/fstab"
[[ "$BOOT_DEVICE" == 'usb' ]] && chroot "${rootfs_dir}" /bin/bash -c "ln -rsf /etc/fstab.usb /etc/fstab"
[[ "$BOOT_DEVICE" == 'hdd' ]] && chroot "${rootfs_dir}" /bin/bash -c "ln -rsf /etc/fstab.hdd /etc/fstab"

echo "### Running apt in chroot"
sed -i -e "s/_release_/$release/g" "${rootfs_dir}/etc/apt/sources.list"
Expand Down Expand Up @@ -113,8 +113,17 @@ EOF

# Enable zram (swap and logging)
if [[ ${ZRAM_ENABLED} == 'on' ]]; then
echo "### Enable ZRAM"
chroot ${rootfs_dir} systemctl enable armbian-zram-config.service
chroot ${rootfs_dir} systemctl enable armbian-ramlog.service
else
echo "### Enable SWAP"
chroot ${rootfs_dir} systemctl disable armbian-zram-config.service
chroot ${rootfs_dir} systemctl disable armbian-ramlog.service
sed -i 's|#/dev/sda1|/dev/sda1 |' "${rootfs_dir}"/etc/fstab.hdd
sed -i 's|#/dev/sdb3|/dev/sdb3 |' "${rootfs_dir}"/etc/fstab.usb
sed -i 's|#tmpfs|tmpfs |' "${rootfs_dir}"/etc/fstab.hdd
sed -i 's|#tmpfs|tmpfs |' "${rootfs_dir}"/etc/fstab.usb
fi

if [[ ${BUILD_KERNEL} == 'on' ]]; then
Expand Down
2 changes: 1 addition & 1 deletion tweaks/etc/fstab.hdd
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ sysfs /sys sysfs defaults

# Add swap and tmpfs only use if not using ZRAM
#/dev/sda1 swap swap defaults 0 0
#tmpfs /#t#m#p tmpfs mode=1777 0 0
#tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=25% 0 0

2 changes: 1 addition & 1 deletion tweaks/etc/fstab.usb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sysfs /sys sysfs defaults

# Add swap and tmpfs only use if not using ZRAM
#/dev/sdb3 swap swap defaults 0 0
#tmpfs /#t#m#p tmpfs mode=1777 0 0
#tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=25% 0 0

# Add internal harddisk
#/dev/sda1 /mnt/hd-intern ext4 defaults,noatime 0 1
Expand Down

0 comments on commit eb97abe

Please sign in to comment.