updated gui and enforcement
This commit is contained in:
+38
-40
@@ -17,7 +17,7 @@ PYTHON="$VENV_DIR/bin/python"
|
||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME"
|
||||
DESKTOP_FILE="/usr/share/applications/$DESKTOP_ID"
|
||||
|
||||
POLKIT_ACTION="org.sarlink.parentalcontrol.modify"
|
||||
POLKIT_ACTION="org.parentalcontrol.modify"
|
||||
POLKIT_SOURCE="$INSTALL_DIR/$POLKIT_ACTION.policy"
|
||||
POLKIT_DEST="/etc/polkit-1/actions/$POLKIT_ACTION.policy"
|
||||
|
||||
@@ -117,16 +117,22 @@ info "Checking project files"
|
||||
REQUIRED_FILES=(
|
||||
"requirements.txt"
|
||||
"parental-control.service"
|
||||
"$POLKIT_ACTION.policy"
|
||||
|
||||
"app/__init__.py"
|
||||
"app/main.py"
|
||||
"app/database.py"
|
||||
"app/config.py"
|
||||
"app/enforcement.py"
|
||||
"app/scheduler.py"
|
||||
"app/users.py"
|
||||
"app/ipc.py"
|
||||
|
||||
"desktop/__init__.py"
|
||||
"desktop/main.py"
|
||||
"desktop/client.py"
|
||||
|
||||
"config/users.yaml"
|
||||
"config/state.json"
|
||||
)
|
||||
|
||||
for file in "${REQUIRED_FILES[@]}"; do
|
||||
@@ -425,26 +431,20 @@ success "Source tree owned by $INSTALL_USER."
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Prepare data directory
|
||||
# Verify configuration
|
||||
# ============================================================
|
||||
|
||||
info "Preparing application data"
|
||||
info "Checking application configuration"
|
||||
|
||||
mkdir -p "$INSTALL_DIR/data"
|
||||
|
||||
# Database is owned by the root service.
|
||||
chown root:root "$INSTALL_DIR/data"
|
||||
chmod 700 "$INSTALL_DIR/data"
|
||||
|
||||
if [ -f "$INSTALL_DIR/data/parental-control.db" ]; then
|
||||
chown root:root \
|
||||
"$INSTALL_DIR/data/parental-control.db"
|
||||
|
||||
chmod 600 \
|
||||
"$INSTALL_DIR/data/parental-control.db"
|
||||
if [ ! -f "$INSTALL_DIR/config/users.yaml" ]; then
|
||||
error "users.yaml was not found."
|
||||
fi
|
||||
|
||||
success "Data directory secured."
|
||||
if [ ! -f "$INSTALL_DIR/config/state.json" ]; then
|
||||
error "state.json was not found."
|
||||
fi
|
||||
|
||||
success "YAML/JSON configuration files found."
|
||||
|
||||
|
||||
# ============================================================
|
||||
@@ -502,7 +502,7 @@ if [ -f "$POLKIT_SOURCE" ]; then
|
||||
|
||||
else
|
||||
|
||||
warning "Polkit policy file is not present yet."
|
||||
warning "Polkit policy file is not present."
|
||||
warning "Expected: $POLKIT_SOURCE"
|
||||
warning "Skipping polkit policy installation."
|
||||
|
||||
@@ -678,28 +678,6 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Verify database
|
||||
# ============================================================
|
||||
|
||||
info "Checking database"
|
||||
|
||||
if [ -f "$INSTALL_DIR/data/parental-control.db" ]; then
|
||||
|
||||
DB_OWNER="$(stat -c '%U:%G' "$INSTALL_DIR/data/parental-control.db")"
|
||||
DB_MODE="$(stat -c '%a' "$INSTALL_DIR/data/parental-control.db")"
|
||||
|
||||
echo " Owner: $DB_OWNER"
|
||||
echo " Permissions: $DB_MODE"
|
||||
|
||||
else
|
||||
|
||||
warning "Database does not exist yet."
|
||||
warning "The service should create it automatically."
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Final verification
|
||||
# ============================================================
|
||||
@@ -747,6 +725,22 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "$INSTALL_DIR/config/users.yaml" ]; then
|
||||
echo " Users: OK"
|
||||
else
|
||||
echo " Users: FAILED"
|
||||
CHECK_FAILED=1
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "$INSTALL_DIR/config/state.json" ]; then
|
||||
echo " State: OK"
|
||||
else
|
||||
echo " State: FAILED"
|
||||
CHECK_FAILED=1
|
||||
fi
|
||||
|
||||
|
||||
if [ "$CHECK_FAILED" -ne 0 ]; then
|
||||
error "One or more required installation checks failed."
|
||||
fi
|
||||
@@ -780,6 +774,10 @@ echo
|
||||
echo "IPC:"
|
||||
echo " $SOCKET_PATH"
|
||||
echo
|
||||
echo "Configuration:"
|
||||
echo " $INSTALL_DIR/config/users.yaml"
|
||||
echo " $INSTALL_DIR/config/state.json"
|
||||
echo
|
||||
echo "Installation:"
|
||||
echo " $INSTALL_DIR"
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user