What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

amtm AMTM and post-mount script

gk802

Regular Contributor
I notice that amtm modifies my post-mount script file and removes my own code for activating my swap file and replaces it with its own. Is there a way to override that and prevent that from happening?

UPDATE: found it. seems I needed a space following a "do-not-check-swap" comment in my post-mount script.
 
Last edited:
When things begin to fail, start there (i.e. the changes you're making).
 
Nothing's failing. It's a script that's been in use for years...until it was modified by an add-on. It did take a while to find the script that was modifying it...then to find why the "don't modify" comment wasn't being picked up by the grep command.
 
UPDATE: found it. seems I needed a space following a "do-not-check-swap" comment in my post-mount script.
Well, that's very odd because I have in my script the "do-not-check-swap" string as a comment *without* any trailing spaces, and it's been working well and as intended for a long time since I put it there.

This is the code in AMTM:
Bash:
/tmp/home/root$ grep -A 5 -B 1 "do-not-check-swap" /jffs/addons/amtm/swap.mod
    writeswaploc(){
        if ! grep -q 'do-not-check-swap' /jffs/scripts/post-mount 2> /dev/null; then
            [ -f /jffs/scripts/post-mount ] && sed -i '\~swapon ~d' /jffs/scripts/post-mount
            c_j_s /jffs/scripts/post-mount
            t_f /jffs/scripts/post-mount
            sed -i "1a swapon $swl # Added by amtm" /jffs/scripts/post-mount
            swapon "$swl" 2> /dev/null
--
    remove_swap_entries(){
        if grep -q 'swapon.*\.' /jffs/scripts/post-mount && ! grep -q 'do-not-check-swap' /jffs/scripts/post-mount; then
            sed -i '\~swapon ~d' /jffs/scripts/post-mount
            swtxt=" No swap file found, reference removed in\\n /jffs/scripts/post-mount"
            am=;r_m swap.mod
        fi
    }
--
manage_swap(){
    if [ -f /jffs/scripts/post-mount ] && grep -q 'do-not-check-swap' /jffs/scripts/post-mount; then
        p_e_l
        echo " Found \"do-not-check-swap\" entry in"
        echo " /jffs/scripts/post-mount. Diversion and amtm"
        echo " will not auto-correct paths."
    fi

As we can see, the grep cmds don't care what's before or after the "do-not-check-swap" string.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top