1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-08 15:10:45 +02:00

add lighttpd.bin with PCRE

This commit is contained in:
Julian Tatsch
2018-05-26 09:45:20 +02:00
parent 460132503a
commit a4e3586857
2 changed files with 85 additions and 1 deletions

View File

@@ -3,7 +3,11 @@
# Github autodownload script
# See usage for help
# Edit the global variables to change the repo and initial folder
<<<<<<< HEAD
# Depends on curl, jq (json parser), openssl (SHA calculation)
=======
# Depends on curl, jq (jason parser), openssl (SHA calculation)
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
# owner name and repo name
REPO="EliasKotlyar/Xiaomi-Dafang-Hacks"
@@ -15,6 +19,7 @@ REMOTEFOLDER="firmware_mod"
DESTFOLDER="./"
DESTOVERRIDE="/tmp/Update"
# The list of exclude, can have multple filter with "*.conf|*.sh"
<<<<<<< HEAD
EXCLUDEFILTER="*.conf|*.user"
GITHUBURL="https://api.github.com/repos"
GITHUBURLRAW="https://raw.githubusercontent.com"
@@ -22,6 +27,21 @@ CURL="/system/sdcard/bin/curl -k"
JQ="/system/sdcard/bin/jq"
SHA="/system/sdcard/bin/openssl dgst -sha256"
BASENAME="/system/sdcard/bin/busybox basename"
=======
EXCLUDEFILTER=""
#"*.conf|*.user|run.sh|osd|autoupdate.sh|libcrypto.so.42|curl|curl.bin|libssl.so.44|libz.so.1"
# Somme URL
GITHUBURL="https://api.github.com/repos"
GITHUBURLRAW="https://raw.githubusercontent.com"
CURL="curl -k"
JQ="jq"
SHA="openssl dgst -sha256"
BASENAME="basename"
#CURL="/system/sdcard/bin/curl -k"
#JQ="/system/sdcard/bin/jq"
#SHA="/system/sdcard/bin/openssl dgst -sha256"
#BASENAME="/system/sdcard/bin/busybox basename"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
TMPFILE=/tmp/udpate.tmp
BACKUPEXT=.backup
@@ -47,7 +67,7 @@ usage()
echo "-v (--verbose) for verbose"
echo "-u (--user) githup login/password (not mandatory, but sometime anonymous account get banned)"
echo "-h (--help) for this help"
echo
echo
echo "Note that ${EXCLUDEFILTER} will be excluded"
echo "Examples:"
echo "Update all files if needed >$1 -d /system/sdcard (-f to force update)"
@@ -135,10 +155,17 @@ getfiles()
countdownreboot()
{
i=10
<<<<<<< HEAD
while [ ${i} -gt 0 ];
do
echo "$i seconds remaining before reboot (Press control-c to abort)";
i=$((${i} - 1))
=======
while [ $i -gt 0 ];
do
echo "$i seconds remaining before rebooting (control-c to abort)";
i=`expr $i - 1`;
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
sleep 1;
done
action reboot
@@ -186,7 +213,11 @@ do
esac
done
<<<<<<< HEAD
log "Starting AutoUpdate"
=======
log "Start"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
if [ ${_FORCE} = 1 ]; then
log "Forcing update."
@@ -202,7 +233,11 @@ fi
action "rm -rf ${DESTOVERRIDE} 2>/dev/null"
<<<<<<< HEAD
log "Getting list of remote files."
=======
log "Get list of files"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
FIRST=$(${CURL} -s ${GITHUBURL}/${REPO}/contents/${REMOTEFOLDER}?ref=${BRANCH})
FILES=$(getfiles "${FIRST}")
# For all the repository files
@@ -214,13 +249,21 @@ do
# Remove files that match the filter
res=$(ismatch ${LOCALFILE})
if [ "$res" == "match" ]; then
<<<<<<< HEAD
echo "${LOCALFILE} is excluded due to filter."
=======
echo "${LOCALFILE} is excluded due to filter"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
continue
fi
# Get the file temporally to calculate SHA
${CURL} -s ${i} -o ${TMPFILE} 2>/dev/null
if [ ! -f ${TMPFILE} ]; then
<<<<<<< HEAD
echo "Can not get remote file $i, exiting."
=======
echo "Can not get remote file $i, exit"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
exit 1
fi
@@ -232,18 +275,29 @@ do
# log "SHA of $LOCALFILE is ${LOCALSHA} ** remote is ${REMOTESHA}"
if [ "${REMOTESHA}" = "${LOCALSHA}" ] ; then
<<<<<<< HEAD
echo "${LOCALFILE} is up to date."
else
if [ ${_FORCE} = 1 ]; then
echo "${LOCALFILE} updated."
=======
echo "${LOCALFILE} is OK"
else
if [ ${_FORCE} = 1 ]; then
echo "${LOCALFILE} updated"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
if [ ${_BACKUP} = 1 ]; then
action cp ${LOCALFILE} ${DESTOVERRIDE}/${LOCALFILE}${BACKUPEXT}
fi
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
else
<<<<<<< HEAD
echo "${LOCALFILE} needs to be updated. Overwrite?"
echo "[Y]es or [N]o or [A]ll?"
=======
echo "${LOCALFILE} need to be updated, overwrite [Y]es or [N]o or [A]ll ?"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not updated"
@@ -263,6 +317,7 @@ do
fi
else
if [ ${_FORCE} = 1 ]; then
<<<<<<< HEAD
echo "${LOCALFILE} created."
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
@@ -272,6 +327,16 @@ do
rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not created."
=======
echo "${LOCALFILE} created"
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
else
echo "${LOCALFILE} doesn't exist, create it [Y]es or [N]o or [A]ll ?"
rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not created"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
rm -f ${TMPFILE} 2>/dev/null
else
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
@@ -285,6 +350,7 @@ do
done
if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) > 1 ]; then
<<<<<<< HEAD
echo "--------------- Stopping services ---------"
for i in /system/sdcard/controlscripts/*; do
echo stopping $i
@@ -303,11 +369,29 @@ if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) >
else
echo "A reboot is needed, do you want to reboot now?"
echo "[Y]es or [N]o"
=======
echo "--------------- Stop services ---------"
echo "--------------- Update files ----------"
action "cp -Rf ${DESTOVERRIDE}/* ${DESTFOLDER} 2>/dev/null"
action "rm -Rf ${DESTOVERRIDE}/* 2>/dev/null"
echo "--------------- Reboot ----------"
if [ ${_FORCEREBOOT} = 1 ]; then
countdownreboot
else
echo "reboot is needed, do you want to do it now ?"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
rep=$(ask_yes_or_no )
if [ "${rep}" = "yes" ]; then
countdownreboot
fi
fi
else
<<<<<<< HEAD
echo "No files to update."
=======
echo "No updated files, no action"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
fi

Binary file not shown.