Page 1 of 1

Root script at startup

Posted: 24 Jun 2019, 18:05
by M. Eerie
I've been trying to insert some routines to the startup sequence (...Ah-miga ) to patch the system depending on whether I am at home or at work.

To do certain tasks, I need elevated privileges, and this is where cliexec=myscript cheatcode, comes around. But every time I open a terminal, it tries to execute myscript :%)

For example @work where memory is limited, I'm removing the foreign locales:

Code: Select all

# REMOVE FOREIGN LOCALES
GLOBIGNORE=es:es_ES*:en:en_US*:locale.alias
cd /usr/share/locale
rm -r -- *
cd -
unset GLOBIGNORE

#PATCH DoubleCmd
if [[ $(lsblk -rno label | grep -E "APORTEUS|NEMESIS") ]] ; then
   sed -i 's/Bar1>True/Bar1>False/g' /home/guest/.config/doublecmd/doublecmd.xml
fi
...
This is fine, but then I need to mount a filesystem:

Code: Select all

[[ -f /mnt/sda1/tmp/myfiledisk ]] && mkdir -p /mnt/myfiledisk && mount /mnt/sda1/tmp/myfiledisk /mnt/myfiledisk
Obviously, it will fail, trying to mkdir @ /mnt.

Any help?

Thanks in advance. :)

Cheers!

Root script at startup

Posted: 24 Jun 2019, 23:37
by ncmprhnsbl
try putting your scripts in /etc/local.d and name them <myscriptname>.start (and be executable)
for example, i have a script that sets the power state for my graphics card, that i have in a module:

Code: Select all

ati-power/ati-pf
└── etc
    └── local.d
        └── atipowerstate.start

Root script at startup

Posted: 25 Jun 2019, 20:16
by M. Eerie
Yessssss !

That worked :beer: