mirror of
https://github.com/pocopico/tinycore-redpill.git
synced 2025-09-15 12:51:13 +08:00
0.10.9, **Critical, Fixed missing init.post patch
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -17,7 +17,7 @@ SCRIPTREPO="https://github.com/pocopico/tinycore-redpill/raw/main/html/index.sh"
|
||||
extensionrepofile="https://github.com/pocopico/tcrp-addons/raw/main/addons.json"
|
||||
extensionfile="addons.json"
|
||||
TOOLS="bspatch bzImage-to-vmlinux.sh calc_run_size.sh crc32 dtc kexec ramdisk-patch.sh vmlinux-to-bzImage.sh xxd zimage-patch.sh kpatch zImage_template.gz grub-editenv"
|
||||
SCRIPTVERSION="0.10.8"
|
||||
SCRIPTVERSION="0.10.9"
|
||||
|
||||
#. ${HOMEPATH}/include/config.sh
|
||||
############################################
|
||||
@ -35,6 +35,7 @@ function versionhistory() {
|
||||
<br> 0.10.6, Added, Logs viewer, and fixed some bugs.
|
||||
<br> 0.10.7, Enhanced the redpill model detection as some modules failed to be included.
|
||||
<br> 0.10.8, Created the filemanagement function, and added the ability to process files.
|
||||
<br> 0.10.9, **Critical, Fixed missing init.post patch
|
||||
|
||||
EOF
|
||||
|
||||
@ -1947,6 +1948,36 @@ function patchramdisk() {
|
||||
for key in $(echo $SYNOINFO_USER | jq -re '. | keys_unsorted' | sed -e 's/\[//g' -e 's/\]//g' -e 's/"//g' -e 's/,//g'); do
|
||||
[ $(grep $key ${temprd}/etc/synoinfo.conf | wc -l) -le 0 ] && echo "Key $key : not found in synoinfo.conf" || echo "Key $key : OK "
|
||||
done
|
||||
|
||||
wecho "Patching sbin/init.post"
|
||||
status "setstatus" "ramdiskpatch" "false" "Patching init.post"
|
||||
grep -v -e '^[\t ]*#' -e '^$' "${HOMEPATH}/html/patch/config-manipulators.sh" >"${HOMEPATH}/rp.txt"
|
||||
sed -e "/@@@CONFIG-MANIPULATORS-TOOLS@@@/ {" -e "r ${HOMEPATH}/rp.txt" -e 'd' -e '}' -i "${temprd}/sbin/init.post"
|
||||
rm "${HOMEPATH}/rp.txt"
|
||||
touch "${HOMEPATH}/rp.txt"
|
||||
|
||||
echo "Applying model synoinfo patches"
|
||||
|
||||
while IFS=":" read KEY VALUE; do
|
||||
echo "Key : $KEY Value: $VALUE"
|
||||
KEY="$(echo $KEY | xargs)" && VALUE="$(echo $VALUE | xargs)"
|
||||
_set_conf_kv "${KEY}" "${VALUE}" $temprd/etc/synoinfo.conf
|
||||
echo "_set_conf_kv \"${KEY}\" \"${VALUE}\" /tmpRoot/etc/synoinfo.conf" >>"${HOMEPATH}/rp.txt"
|
||||
echo "_set_conf_kv \"${KEY}\" \"${VALUE}\" /tmpRoot/etc.defaults/synoinfo.conf" >>"${HOMEPATH}/rp.txt"
|
||||
done <<<$(echo $SYNOINFO_PATCH | jq . | grep ":" | sed -e 's/"//g' | sed -e 's/,//g')
|
||||
|
||||
echo "Applying user synoinfo settings"
|
||||
|
||||
while IFS=":" read KEY VALUE; do
|
||||
echo "Key : $KEY Value: $VALUE"
|
||||
KEY="$(echo $KEY | xargs)" && VALUE="$(echo $VALUE | xargs)"
|
||||
_set_conf_kv "${KEY}" "${VALUE}" $temprd/etc/synoinfo.conf
|
||||
echo "_set_conf_kv \"${KEY}\" \"${VALUE}\" /tmpRoot/etc/synoinfo.conf" >>"${HOMEPATH}/rp.txt"
|
||||
echo "_set_conf_kv \"${KEY}\" \"${VALUE}\" /tmpRoot/etc.defaults/synoinfo.conf" >>"${HOMEPATH}/rp.txt"
|
||||
done <<<$(echo $SYNOINFO_USER | jq . | grep ":" | sed -e 's/"//g' | sed -e 's/,//g')
|
||||
|
||||
sed -e "/@@@CONFIG-GENERATED@@@/ {" -e "r ${HOMEPATH}/rp.txt" -e 'd' -e '}' -i "${temprd}/sbin/init.post"
|
||||
rm ${HOMEPATH}/rp.txt
|
||||
|
||||
wecho "Copying extra ramdisk files "
|
||||
status "setstatus" "ramdiskpatch" "false" "Copying extra ramdisk files"
|
||||
|
41
html/patch/config-manipulators.sh
Normal file
41
html/patch/config-manipulators.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# WARNING: this file is also embedded in the post-init patcher, so don't go to crazy with the syntax/tools as it must
|
||||
# be able to execute in the initramfs/preboot environment (so no bashism etc)
|
||||
# All comments will be stripped, functions here should NOT start with brp_ as they're not part of the builder
|
||||
|
||||
|
||||
if [ -z ${SED_PATH+x} ]; then
|
||||
echo "Your SED_PATH variable is not set/is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
##$1 from, $2 to, $3 file to path
|
||||
_replace_in_file()
|
||||
{
|
||||
if grep -q "$1" "$3"; then
|
||||
$SED_PATH -i "$3" -e "s#$1#$2#"
|
||||
fi
|
||||
}
|
||||
|
||||
# Replace/remove/add values in .conf K=V file
|
||||
#
|
||||
# Args: $1 name, $2 new_val, $3 path
|
||||
_set_conf_kv()
|
||||
{
|
||||
# Delete
|
||||
if [ -z "$2" ]; then
|
||||
$SED_PATH -i "$3" -e "s/^$1=.*$//"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# Replace
|
||||
if grep -q "^$1=" "$3"; then
|
||||
$SED_PATH -i "$3" -e "s\"^$1=.*\"$1=\\\"$2\\\"\""
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Add if doesn't exist
|
||||
echo "$1=\"$2\"" >> $3
|
||||
}
|
Reference in New Issue
Block a user