Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
powerAn2020 committed Jun 5, 2024
0 parents commit ce378fa
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 0 deletions.
33 changes: 33 additions & 0 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/sbin/sh

#################
# Initialization
#################

umask 022

# echo before loading util_functions
ui_print() { echo "$1"; }

require_new_magisk() {
ui_print "*******************************"
ui_print " Please install Magisk v20.4+! "
ui_print "*******************************"
exit 1
}

#########################
# Load util_functions.sh
#########################

OUTFD=$2
ZIPFILE=$3

mount /data 2>/dev/null

[ -f /data/adb/magisk/util_functions.sh ] && {
. /data/adb/magisk/util_functions.sh
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
install_module
exit 0
}
1 change: 1 addition & 0 deletions META-INF/com/google/android/updater-script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#MAGISK
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# crond4Android

支持 KernelSU、APatch、Magisk下运行。调用对应框架busybox实现crond定时。

## 数据目录

日志: `/data/adb/crond/run.log`

任务数据: `/data/adb/crond/`

crontab: `/system/xbin/crontab`
`注意:如果替换了root实现方案,记得修改这个脚本,或者重新安装一次,不然无法执行。`
## 使用样例

```shell
# 创建任务 (也可以直接编辑文件)
echo '53 * * * * command' >> /data/adb/crond/root # for root user
# 查看任务
crontab -c /data/adb/crond -l
```
38 changes: 38 additions & 0 deletions customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

if [ "$BOOTMODE" != true ]; then
ui_print "-----------------------------------------------------------"
ui_print "! Please install in Magisk Manager or KernelSU Manager or APatch Manager"
ui_print "! Install from recovery is NOT supported"
abort "-----------------------------------------------------------"
fi

cronDataDir='/data/adb/crond'
crontabCmd="${MODPATH}/system/xbin/crontab"

if [ ! -d ${cronDataDir} ];then
ui_print "mkdir ${cronDataDir}"
mkdir -p ${cronDataDir}
touch ${cronDataDir}/root
fi

ui_print "- Installed crontab cmd to ${crontabCmd}"
echo '#!/system/bin/sh' >${crontabCmd}

if [ "$KSU" = true ]; then
ui_print "- kernelSU version: $KSU_VER ($KSU_VER_CODE)"
echo '/data/adb/ksu/bin/busybox crontab -c '${cronDataDir}' $@' >> ${crontabCmd}
elif [ "$APATCH" = true ]; then
ui_print "- APatch version: $APATCH_VER ($APATCH_VER_CODE)"
echo '/data/adb/ap/bin/busybox crontab -c '${cronDataDir}' $@' >> ${crontabCmd}
else
ui_print "- Magisk version: $MAGISK_VER ($MAGISK_VER_CODE)"
echo '/data/adb/magisk/bin/busybox crontab -c '${cronDataDir}' $@' >> ${crontabCmd}
fi

ui_print "set_perm"

set_perm ${crontabCmd} 0 0 0755
set_perm $MODPATH/service.sh 0 0 0755
set_perm $MODPATH/uninstall.sh 0 0 0755

ui_print "done"
6 changes: 6 additions & 0 deletions module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id=crond4android
name=Crond for Android
version=1.0.0
versionCode=100
author=powerAn2020
description=Busybox Crond with service scripts for Android
15 changes: 15 additions & 0 deletions service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/system/bin/sh

cronDataDir='/data/adb/crond'
args="crond -b -c ${cronDataDir} -L ${cronDataDir}/run.log"
# check version
if [ "$KSU" = true ]; then
echo "- kernelSU version: $KSU_VER ($KSU_VER_CODE)"
/data/adb/ksu/bin/busybox $args
elif [ "$APATCH" = true ]; then
echo "- APatch version: $APATCH_VER ($APATCH_VER_CODE)"
/data/adb/ap/bin/busybox $args
else
echo "- Magisk version: $MAGISK_VER ($MAGISK_VER_CODE)"
/data/adb/magisk/busybox $args
fi
5 changes: 5 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/system/bin/sh

if [ ! -f "/data/adb/crond/KEEP_ON_UNINSTALL" ]; then
rm -rf /data/adb/crond
fi

0 comments on commit ce378fa

Please sign in to comment.