mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
Update install.sh
This commit is contained in:
parent
ff922479ba
commit
6198e375fa
45
install.sh
45
install.sh
@ -1136,36 +1136,43 @@ install_packages() {
|
|||||||
|
|
||||||
|
|
||||||
edit_fstab() {
|
edit_fstab() {
|
||||||
|
echo "Setting quotas for disk limits of user files"
|
||||||
|
fstab_file="/etc/fstab"
|
||||||
|
backup_file="/etc/fstab.bak"
|
||||||
|
|
||||||
echo "Setting quotas for disk limits of user files"
|
# Backup the original fstab file
|
||||||
fstab_file="/etc/fstab"
|
cp "$fstab_file" "$backup_file"
|
||||||
root_entry=$(grep -E '^\S+\s+/.*' "$fstab_file")
|
|
||||||
|
|
||||||
if [[ "$root_entry" =~ "usrquota" && "$root_entry" =~ "grpquota" ]]; then
|
# Check if usrquota and grpquota are already set
|
||||||
echo "Success, usrquota and grpquota are already set for /"
|
if grep -qE '^[^#]\S+\s+/\s+\S+\s+.*usrquota.*grpquota' "$fstab_file"; then
|
||||||
else
|
echo "Success, usrquota and grpquota are already set for /"
|
||||||
# Add usrquota and grpquota to the fstab entry (only for the root entry)
|
else
|
||||||
sudo sed -i 's|^\(LABEL=cloudimg-rootfs\s*/\s*ext4\s*[^,]*\)|\1,usrquota,grpquota|' "$fstab_file"
|
echo "Adding usrquota and grpquota to / entry in fstab..."
|
||||||
|
|
||||||
echo "Success, usrquota and grpquota have been added to / entry in fstab, remounting.."
|
# Modify the / entry to include usrquota,grpquota correctly
|
||||||
fi
|
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
|
systemctl daemon-reload
|
||||||
quotaoff -a
|
quotaoff -a
|
||||||
mount -o remount,usrquota,grpquota /
|
mount -o remount,usrquota,grpquota /
|
||||||
mount /dev/vda1 /mnt
|
|
||||||
cd /mnt
|
# Ensure quota files exist
|
||||||
chmod 600 aquota.user aquota.group
|
touch /aquota.user /aquota.group
|
||||||
|
chmod 600 /aquota.user /aquota.group
|
||||||
quotacheck -cum / -f
|
quotacheck -cum / -f
|
||||||
quotaon -a
|
quotaon -a
|
||||||
repquota /
|
|
||||||
|
# Generate quota report
|
||||||
|
repquota / > /etc/openpanel/openpanel/core/users/repquota
|
||||||
|
|
||||||
|
echo "Testing quotas..."
|
||||||
quota -v
|
quota -v
|
||||||
|
|
||||||
echo "Testing quotas.."
|
|
||||||
repquota -u / > /etc/openpanel/openpanel/core/users/repquota
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set_system_cronjob(){
|
set_system_cronjob(){
|
||||||
echo "Setting cronjobs.."
|
echo "Setting cronjobs.."
|
||||||
mv ${ETC_DIR}cron /etc/cron.d/openpanel
|
mv ${ETC_DIR}cron /etc/cron.d/openpanel
|
||||||
|
Loading…
Reference in New Issue
Block a user