diff --git a/scripts/linux/diffConfig.sh b/scripts/linux/diffConfig.sh new file mode 100755 index 0000000000000000000000000000000000000000..48ff4388dbfd74acb65283bb23c76cf1ae4d33fe --- /dev/null +++ b/scripts/linux/diffConfig.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +SHOW_FULL=false +if [ "$2" = "-f" ]; then + SHOW_FULL=true +fi + +mapfile -t ADDED < <(git diff "$1" |grep -E '^(\+)[^+]' | sed 's/^.//') +mapfile -t REMOVED < <(git diff "$1" |grep -E '^(\-)[^-]' | sed 's/^.//') + +is_removed() { + local to_check="$1" + for x in "${REMOVED[@]}"; do + [ "$to_check" = "$x" ] && return 0 + done + return 1 +} + +is_added() { + local to_check="$1" + for x in "${ADDED[@]}"; do + [ "$to_check" = "$x" ] && return 0 + done + return 1 +} + +total_added=() +total_removed=() +total_changed=() + +for i in "${ADDED[@]}"; do + if is_added "$i" && ! is_removed "$i" ; then + total_added+=("$i") + fi +done +for i in "${REMOVED[@]}"; do + if ! is_added "$i" && is_removed "$i"; then + total_removed+=("$i") + fi +done +for i in "${ADDED[@]}"; do + if is_added "$i" && is_removed "$i"; then + total_changed+=("$i") + fi +done + +if [ ${#total_added[*]} -gt 0 ]; then + echo "+++ added:" + printf '\e[32m%s\e[0m\n' "${total_added[@]}" +fi + +if [ ${#total_removed[*]} -gt 0 ]; then + echo "--- removed:" + printf '\e[31m%s\e[0m\n' "${total_removed[@]}" +fi + +if [ $SHOW_FULL = true ] && [ ${#total_changed[*]} -gt 0 ]; then + echo "ยงยงยง Postition changed:" + printf '\e[33m%s\e[0m\n' "${total_changed[@]}" +fi + + diff --git a/scripts/linux/mountOverlay.sh b/scripts/linux/mountOverlay.sh new file mode 100755 index 0000000000000000000000000000000000000000..3083a91bd3f8a2348d32ce4a683d1b992924ecf8 --- /dev/null +++ b/scripts/linux/mountOverlay.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "missing device" >&2 + echo "please specify sdcard (/dev/mmcblk0) of usb key (/dev/sdb)" >&2 + exit 1 +fi + +DEVICE="$1" +if [[ "$DEVICE" =~ mmcblk ]]; then + BOOTDEVICE="${DEVICE}p1" +else + BOOTDEVICE="${DEVICE}1" +fi + + +mkdir -p /tmp/recalbox/lower /tmp/recalbox/upper /tmp/recalbox/work /tmp/recalbox/boot /tmp/recalbox/root +sudo mount "$BOOTDEVICE" /tmp/recalbox/boot || exit 1 +sudo mount /tmp/recalbox/boot/boot/recalbox /tmp/recalbox/lower || exit 1 +sudo mount -t overlay overlay -o rw,lowerdir=/tmp/recalbox/lower,upperdir=/tmp/recalbox/upper,workdir=/tmp/recalbox/work /tmp/recalbox/root || exit 1 + +echo "root file system is accessible from /tmp/recalbox/root" +echo "once finished:" +echo "umount /tmp/recalbox/root" +echo "umount /tmp/recalbox/lower" +echo "umount /tmp/recalbox/boot"