Update install.sh

This commit is contained in:
Radovan Ječmenica 2025-02-05 15:54:15 +01:00 committed by GitHub
parent ff922479ba
commit 6198e375fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1136,36 +1136,43 @@ install_packages() {
edit_fstab() {
echo "Setting quotas for disk limits of user files"
fstab_file="/etc/fstab"
root_entry=$(grep -E '^\S+\s+/.*' "$fstab_file")
if [[ "$root_entry" =~ "usrquota" && "$root_entry" =~ "grpquota" ]]; then
echo "Success, usrquota and grpquota are already set for /"
else
# Add usrquota and grpquota to the fstab entry (only for the root entry)
sudo sed -i 's|^\(LABEL=cloudimg-rootfs\s*/\s*ext4\s*[^,]*\)|\1,usrquota,grpquota|' "$fstab_file"
echo "Success, usrquota and grpquota have been added to / entry in fstab, remounting.."
fi
systemctl daemon-reload
echo "Setting quotas for disk limits of user files"
fstab_file="/etc/fstab"
backup_file="/etc/fstab.bak"
# Backup the original fstab file
cp "$fstab_file" "$backup_file"
# Check if usrquota and grpquota are already set
if grep -qE '^[^#]\S+\s+/\s+\S+\s+.*usrquota.*grpquota' "$fstab_file"; then
echo "Success, usrquota and grpquota are already set for /"
else
echo "Adding usrquota and grpquota to / entry in fstab..."
# Modify the / entry to include usrquota,grpquota correctly
sed -i -E '/\s+\/\s+/s/(\S+)(\s+\/\s+\S+\s+\S+)(\s+[0-9]+\s+[0-9]+)$/\1\2,usrquota,grpquota\3/' "$fstab_file"
echo "Success, usrquota and grpquota have been added to / entry in fstab, remounting.."
fi
# Apply changes
systemctl daemon-reload
quotaoff -a
mount -o remount,usrquota,grpquota /
mount /dev/vda1 /mnt
cd /mnt
chmod 600 aquota.user aquota.group
# Ensure quota files exist
touch /aquota.user /aquota.group
chmod 600 /aquota.user /aquota.group
quotacheck -cum / -f
quotaon -a
repquota /
quota -v
echo "Testing quotas.."
repquota -u / > /etc/openpanel/openpanel/core/users/repquota
# Generate quota report
repquota / > /etc/openpanel/openpanel/core/users/repquota
echo "Testing quotas..."
quota -v
}
set_system_cronjob(){
echo "Setting cronjobs.."
mv ${ETC_DIR}cron /etc/cron.d/openpanel