by Joshua Gates
Version 1 (December 15, 2024)
Download (14 downloads)
Acelerar o carregamento
-Falhas
Ao retirar a script continua ativada
Ao terminar a script desliga e não se auto-inicia
Caio23364
#!/system/bin/sh
# Log file location
LOG_FILE="/data/local/tmp/boot_log.txt"
# Function to log messages
log_message() {
echo "$(date): $1" >> "$LOG_FILE"
}
# Initialize log
echo "====== Boot Script Started ======" > "$LOG_FILE"
# Log boot completed
log_message "Device booted successfully."
# Change permissions on a sample file
TARGET_FILE="/data/local/tmp/sample_file.txt"
if [ -f "$TARGET_FILE" ]; then
chmod 644 "$TARGET_FILE"
log_message "Changed permissions for $TARGET_FILE to 644."
else
echo "Sample file does not exist. Creating it..." >> "$LOG_FILE"
echo "This is a sample file." > "$TARGET_FILE"
chmod 644 "$TARGET_FILE"
log_message "Created and updated permissions for $TARGET_FILE."
fi
# Mount a filesystem (example: remount system as read-write)
MOUNT_POINT="/system"
if mount | grep "$MOUNT_POINT" | grep "ro,"; then
mount -o rw,remount "$MOUNT_POINT"
log_message "Remounted $MOUNT_POINT as read-write."
else
log_message "$MOUNT_POINT is already read-write."
fi
# Set a custom system property
setprop persist.myapp.bootflag 1
log_message "Set system property persist.myapp.bootflag to 1."
# Start an activity or application (if using root permissions)
# Example: Open the MainActivity of a specific package
PACKAGE_NAME="com.example.activitieslauncher"
am start -n "$PACKAGE_NAME/.MainActivity" >> "$LOG_FILE" 2>&1
log_message "Launched MainActivity of $PACKAGE_NAME."
# End log
log_message "Boot script completed."
echo "====== Script Finished ======" >> "$LOG_FILE"