Root script at startup

Arch based Porteus community project
Post Reply
User avatar
M. Eerie
Shogun
Shogun
Posts: 214
Joined: 31 Aug 2017, 21:18
Distribution: APorteus BUDGIE x64

Root script at startup

Post#1 by M. Eerie » 24 Jun 2019, 18:05

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!

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 2480
Joined: 20 Mar 2012, 03:42
Distribution: 5.0rc1-64bit all-DE+more
Location: australia
Contact:

Root script at startup

Post#2 by ncmprhnsbl » 24 Jun 2019, 23:37

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
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
M. Eerie
Shogun
Shogun
Posts: 214
Joined: 31 Aug 2017, 21:18
Distribution: APorteus BUDGIE x64

Root script at startup

Post#3 by M. Eerie » 25 Jun 2019, 20:16

Yessssss !

That worked :beer:

Post Reply