Porteus 5.0 USB Live - rc.local customizing

Post here if you are a new Porteus member and you're looking for some help.
inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

Porteus 5.0 USB Live - rc.local customizing

Post#1 by inukaze » 22 Jul 2023, 03:28

Hi there again, i need

1 - add option to mount drive during boot, but the /etc/fstab is automatically re-generated every boot

This is my current /etc/fstab content

Code: Select all

# Do not edit this file as fstab is recreated automatically during every boot.
# Please use /etc/rc.d/rc.local or sysvinit scripts if you want to mount/unmount
# drive, filesystem or network share.

# System mounts:
aufs / aufs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devtmpfs /dev devtmpfs defaults 0 0
devpts /dev/pts devpts rw,mode=0620,gid=5 0 0

# Device partitions:

# Hotplugged devices:
/dev/sdb1 /mnt/sdb1 ext4 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda1 /mnt/sda1 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda6 /mnt/sda6 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda3 /mnt/sda3 ext2 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda2 /mnt/sda2 swap users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sdc2 /mnt/sdc2 ext2 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda5 /mnt/sda5 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sdc3 /mnt/sdc3 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sdc1 /mnt/sdc1 exfat users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
well in the fstab i just need the line

Code: Select all

/dev/sdc1 /mnt/sdc1 exfat users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
just add "rw," before "users", to let me write files/folders like normal user, i suppose i can't write it like normal user by the exFAT format

Code: Select all

/dev/sdc1 /mnt/sdc1 exfat rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
How should be the line on rc.local for mount the exFAT partition like i need ? i prefer mount by UUID

But thinking better i prefer some partitions mount by "label" instead of /mnt/sd[X#] for example /dev/sda1 on my machine had label "Compartido" i prefer that mount on /mnt/Compartido.

Well the another thing i want to mount during boot is some mount intranet cifs folders, because samba not mount correctly

i just thinking how i should use the /etc/rc.d/rc.local file for mounts things i need, for example something like :

Code: Select all

#CIFS Mount(s) :
#First, create folders for mountpoints
mkdir -p /mnt/cifs/Temporal
mkdir -p /mnt/cifs/Inukaze
mkdir -p /mnt/cifs/Inukaze-en-Familia
mkdir -p /mnt/cifs/Josmar

#Second, mount cifs. i need to know how i can enable the options for allow my cifs user can delete files from cifs. 
# Because the option "dir_mode=01777" , let me create files, but does not allow me delete files and/or folders.
#i need improve this part for check on background if 192.168.1.10 is accesible, and if not is accesible just ignore it and continue normally

mount -t cifs //192.168.1.10/Inukaze /mnt/cifs/Inukaze -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
mount -t cifs //192.168.1.10/Inukaze-en-Familia /mnt/cifs/Inukaze-en-Familia -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
mount -t cifs //192.168.1.10/Temporal /mnt/cifs/Temporal -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
mount -t cifs //192.168.1.10/Josmar /mnt/cifs/Josmar -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
2 - i put module «ntp» i am thiking in add to rc.local the follow

Code: Select all

#Force Clock Sync via NTP : 
ntpdate=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b ntpdate | grep -i "ntpdate" | cut -d " " -f02 | cut -c11-20)
service=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b service | grep -i "service" | cut -d " " -f02 | cut -c11-20)
rcntpd="/etc/rc.d/rc.ntpd"

if [ -z "$ntpdate" ]; then
        echo
        echo "ntpdate no esta instalado en tu sistema operativo GNU"
        echo "Por favor, instale primero  ntpdate "
        echo
        exit 0
fi

#Slackware(64) :
if [ -d "/etc/rc.d" ];then
        if [ -f "$rcntpd" ]; then
                chmod +x "$rcntpd"
                "$rcntpd" "stop"
                #ntpdate -u 0.south-america.pool.ntp.org
                ntpdate -u time.nist.gov
                hwclock -w
                "$rcntpd" "start"
        fi
fi

#Debians :
if [ -z "$service" ]; then
        echo ""
else
        sudo service ntpd stop
        sudo su -c "rm -rf /etc/localtime" root
        sudo su -c "ln -s /usr/share/zoneinfo/America/Caracas /etc/localtime" root
        echo 'TZ='America/Caracas'; export TZ' >> "$HOME/.profile" ; source "$HOME/.profile"
        sudo update-locale LC_TIME=es_ES.UTF-8
        #ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_ES /usr/share/i18n/locales/es_ES" root
        #ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_ES@euro /usr/share/i18n/locales/es_ES@euro" root
        #ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_VE /usr/share/i18n/locales/es_VE" root
        LANG="es_ES.UTF-8" ; export LANG="$LANG"
        LANGUAGE="es_ES.UTF-8" ; export LANGUAGE='"'"$LANGUAGE"'"'
        LC_ALL="es_ES.UTF-8" ; export LC_ALL="$LC_ALL"
#       ntpdate -u 0.south-america.pool.ntp.org ; hwclock -w
        ntpdate -u time.nist.gov ; hwclock -w
        sudo service ntpd start
fi
in the case of /etc/rc.d/rc.ntpd does not exist, i had that file with the follow content

Code: Select all

#!/bin/sh
# Start/stop/restart ntpd.

# Start ntpd:
ntpd_start() {
  CMDLINE="/usr/sbin/ntpd -g"
  echo -n "Starting NTP daemon:  $CMDLINE"
  $CMDLINE -p /var/run/ntpd.pid
  echo
}

# Stop ntpd:
ntpd_stop() {
  echo -n "Stopping NTP daemon..."
  if [ -r /var/run/ntpd.pid ]; then
    kill -HUP $(cat /var/run/ntpd.pid)
    rm -f /var/run/ntpd.pid
  else
    killall -HUP -q ntpd
  fi
  echo
}

# Restart ntpd:
ntpd_restart() {
  ntpd_stop
  sleep 1
  ntpd_start
}

# Check if ntpd is running
ntpd_status() {
  if [ -e /var/run/ntpd.pid ]; then
    echo "ntpd is running."
  else 
    echo "ntpd is stopped."
    exit 1
  fi
}

case "$1" in
'start')
  ntpd_start
  ;;
'stop')
  ntpd_stop
  ;;
'restart')
  ntpd_restart
  ;;
'status')
  ntpd_status
  ;;
*)
  echo "usage $0 start|stop|restart|status"
esac
another script can be useful is /etc/rc.d/rc.samba with the follow content

Code: Select all

#!/bin/sh
#
# /etc/rc.d/rc.samba
#
# Start/stop/restart the Samba SMB file/print server.
#
# To make Samba start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.samba
#

samba_start() {
  if [ -x /usr/sbin/smbd -a -x /usr/sbin/nmbd -a -r /etc/samba/smb.conf ]; then
    mkdir -p /var/run/samba
    echo "Starting Samba:  /usr/sbin/smbd -D"
    /usr/sbin/smbd -D
    echo "                 /usr/sbin/nmbd -D"
    /usr/sbin/nmbd -D
  elif [ ! -r /etc/samba/smb.conf ]; then
    echo "ERROR:  cannot start Samba since /etc/samba/smb.conf does not exist"
  fi
}

samba_stop() {
  killall smbd nmbd
}

samba_restart() {
  samba_stop
  sleep 2
  samba_start
}

case "$1" in
'start')
  samba_start
  ;;
'stop')
  samba_stop
  ;;
'restart')
  samba_restart
  ;;
*)
  # Default is "start", for backwards compatibility with previous
  # Slackware versions.  This may change to a 'usage' error someday.
  samba_start
esac
Well someone had another ideas can be a good idea put on rc.local ?

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

Porteus 5.0 USB Live - rc.local customizing

Post#2 by inukaze » 22 Jul 2023, 04:08

Well just for testing this is the first content i put on rc.local

Code: Select all

#!/bin/bash
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

#Desmontar particiones (en caso de que esten montadas)

#/dev/sdc1: LABEL="Inukaze" UUID="38C0-FCD0" BLOCK_SIZE="512" TYPE="exfat" PARTUUID="29504791-01"
umount /dev/disk/by-uuid/38C0-FCD0	#Particion «Inukaze» del pendrive
#/dev/sdc2: LABEL="Inicio" UUID="a0784a07-12ba-4131-a646-726a70ad6a55" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="29504791-02"
umount /dev/disk/by-uuid/a0784a07-12ba-4131-a646-726a70ad6a55	#Particion «Inicio» del pendrive
#/dev/sdc3: LABEL="GNU_con_Linux" UUID="23b2374a-ee65-49dc-9abd-562449624a68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="29504791-03"
umount /dev/disk/by-uuid/23b2374a-ee65-49dc-9abd-562449624a68	#Particion «GNU_Con_Linux» contiene Porteus, Modulos, etc . . .

#/dev/sda3: LABEL="2SlackIni" UUID="28026719-c57b-4f9d-bd8d-81b28efade58" BLOCK_SIZE="4096" TYPE="ext2" PTUUID="4197a3bc" PTTYPE="dos" PARTUUID="3e59dc84-03"
umount /dev/disk/by-uuid/28026719-c57b-4f9d-bd8d-81b28efade58	#Disco Duro de 700GB, Particion del GRUB Compartido.
#/dev/sda6: LABEL="Slack32" UUID="c8332c7a-b845-46bb-ab74-feaf3e6095f9" BLOCK_SIZE="4096" TYPE="ext3" PTTYPE="dos" PARTUUID="3e59dc84-06"
umount /dev/disk/by-uuid/c8332c7a-b845-46bb-ab74-feaf3e6095f9	#Disco Duro de 700GB, Particion de Lubuntu 22.04 Actualmente, antes de Slackware32 14.2
#/dev/sda5: LABEL="Slack64" UUID="22df6b3e-2a3a-467b-995e-4fdd08adcc68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="3e59dc84-05"
umount /dev/disk/by-uuid/22df6b3e-2a3a-467b-995e-4fdd08adcc68	#Disco Duro de 700GB, Particion de Slackware64 14.2. Distro Principal
#/dev/sda1: LABEL="Compartido" UUID="bb4117d3-816e-4061-ad50-3947ed396f68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="3e59dc84-01"
umount /dev/disk/by-uuid/bb4117d3-816e-4061-ad50-3947ed396f68	#Disco Duro de 700GB, Particion de Datos «Compartido»(s)
#/dev/sdb1: LABEL="Nicolas" UUID="7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="42091718-01"
umount /dev/disk/by-uuid/7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5	#Disco Duro de 320GB, de «Nicolas»

#Desmontar usando /mnt/sd[X#]
umount /mnt/sda1
umount /mnt/sda3
umount /mnt/sda5
umount /mnt/sda6
umount /mnt/sdb1
umount /mnt/sdc1
umount /mnt/sdc2
umount /mnt/sdc3

#Crear puntos de montaje :
mkdir -p /mnt/USB/Inukaze
mkdir -p /mnt/USB/Inicio
mkdir -p /mnt/USB/GNU_con_Linux
mkdir -p /mnt/2SlackIni
mkdir -p /mnt/Compartido
mkdir -p /mnt/Nicolas
mkdir -p /mnt/Slack32
mkdir -p /mnt/Slack64

#Montar particiones
#Pendrive
mount -t exfat -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/38C0-FCD0 /mnt/USB/Inukaze
mount -t ext2 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/a0784a07-12ba-4131-a646-726a70ad6a55 /mnt/USB/Inicio
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/23b2374a-ee65-49dc-9abd-562449624a68 /mnt/USB/GNU_con_Linux

#Disco Duro 700GB :
mount -t ext2 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/28026719-c57b-4f9d-bd8d-81b28efade58 /mnt/2SlackIni
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/c8332c7a-b845-46bb-ab74-feaf3e6095f9 /mnt/Slack32
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/22df6b3e-2a3a-467b-995e-4fdd08adcc68 /mnt/Slack64
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/bb4117d3-816e-4061-ad50-3947ed396f68 /mnt/Compartido

#Disdo Duro 320GB :
mount -t ext4 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show /dev/disk/by-uuid/7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5 /mnt/Nicolas

#Monturas CIFS :
#Primero crear carpetas para los puntos de montaje
mkdir -p /mnt/cifs/Temporal
mkdir -p /mnt/cifs/Inukaze
mkdir -p /mnt/cifs/Inukaze-en-Familia
mkdir -p /mnt/cifs/Josmar

#Segundo, montar cifs, necesito saber como puedo permitir que mi usuario pueda eliminar archivos/carpetas desde cifs
# Debido a que usando la opcion "dir_mode=01777", me permite crear archivos, pero no me permite eliminar archivos y/o carpetas cifs
# necesito mejorar esta parte, para verificar en segundo plano si «192.168.1.10» es accesible para proceder con el montaje o ignorar y seguir normalmente
$(mount -t cifs //192.168.1.10/Inukaze /mnt/cifs/Inukaze -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL) &
$(mount -t cifs //192.168.1.10/Inukaze-en-Familia /mnt/cifs/Inukaze-en-Familia -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL) &
$(mount -t cifs //192.168.1.10/Temporal /mnt/cifs/Temporal -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL) &
$(mount -t cifs //192.168.1.10/Josmar /mnt/cifs/Josmar -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL) &

#Forzar Sincronizar hora :
ntpdate=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b ntpdate | grep -i "ntpdate" | cut -d " " -f02 | cut -c11-20)
service=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b service | grep -i "service" | cut -d " " -f02 | cut -c11-20)
rcntpd="/etc/rc.d/rc.ntpd"

if [ -z "$ntpdate" ]; then
        echo
        echo "ntpdate no esta instalado en tu sistema operativo GNU"
        echo "Por favor, instale primero  ntpdate "
        echo
        exit 0
fi

#Slackware(64) :
if [ -d "/etc/rc.d" ];then
        if [ -f "$rcntpd" ]; then
                chmod +x "$rcntpd"
                "$rcntpd" "stop"
                #ntpdate -u 0.south-america.pool.ntp.org
                ntpdate -u time.nist.gov
                hwclock -w
                "$rcntpd" "start"
        fi
fi

#Debians :
if [ -z "$service" ]; then
        echo ""
else
        sudo service ntpd stop
        sudo su -c "rm -rf /etc/localtime" root
        sudo su -c "ln -s /usr/share/zoneinfo/America/Caracas /etc/localtime" root
        echo 'TZ='America/Caracas'; export TZ' >> "$HOME/.profile" ; source "$HOME/.profile"
        sudo update-locale LC_TIME=es_ES.UTF-8
        #ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_ES /usr/share/i18n/locales/es_ES" root
        #ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_ES@euro /usr/share/i18n/locales/es_ES@euro" root
        #ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_VE /usr/share/i18n/locales/es_VE" root
        LANG="es_ES.UTF-8" ; export LANG="$LANG"
        LANGUAGE="es_ES.UTF-8" ; export LANGUAGE='"'"$LANGUAGE"'"'
        LC_ALL="es_ES.UTF-8" ; export LC_ALL="$LC_ALL"
#       ntpdate -u 0.south-america.pool.ntp.org ; hwclock -w
        ntpdate -u time.nist.gov ; hwclock -w
        sudo service ntpd start
fi
sdc3 cannot be umounted because from there is where i mount the loopback iso from grub2.
but the another partitions are umounted

mount to /mnt/Compartido, looks like cause a conflict with fusermount of PCManFM-Qt because show a dialog with the message "Operation was cancelled" but too mountpoints are working but just click on «Device» section of PCManFM-Qt access to /mnt/sda1 in this case.

Well i move that points using labels, like symbolic links inside /media instead because i use by that way in the rest of distro i use.
Last edited by inukaze on 23 Jul 2023, 04:58, edited 8 times in total.

User avatar
Blaze
DEV Team
DEV Team
Posts: 3885
Joined: 28 Dec 2010, 11:31
Distribution: ⟰ Porteus current ☯ all DEs ☯
Location: ☭ Russian Federation, Lipetsk region, Dankov
Contact:

Porteus 5.0 USB Live - rc.local customizing

Post#3 by Blaze » 22 Jul 2023, 04:40

Hi inukaze.

1.1 Add this to /etc/rc.d/rc.local

Code: Select all

mkdir -p /mnt/Compartido
sed -i 's|/mnt/sdc1 exfat users|/mnt/Compartido exfat rw,users|' /etc/fstab
1.2 why do you use mount cifs if you can add these shares as bookmarks to the file manager?
Open in file manager smb://hostname/
and your share. Add it to bookmarks of file manager.

2. How about to run as root

Code: Select all

su
toor
cp /etc/localtime{,.bak} && rm /etc/localtime && ln -sf /usr/share/zoneinfo/America/Caracas /etc/localtime && ntpdate pool.ntp.org && hwclock -lw
and add

Code: Select all

ntpdate pool.ntp.org && hwclock -lw
to /etc/rc.d/rc.local ?

2.1 About language. Tweak my module to your settings and locales https://cloud.mail.ru/public/ZmGK/UU1S5 ... ORTEUS-5.0
Linux 6.6.11-porteus #1 SMP PREEMPT_DYNAMIC Sun Jan 14 12:07:37 MSK 2024 x86_64 Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz GenuineIntel GNU/Linux
MS-7A12 » [AMD/ATI] Navi 23 [Radeon RX 6600] [1002:73ff] (rev c7) » Vengeance LPX 16GB DDR4 K2 3200MHz C16

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

Porteus 5.0 USB Live - rc.local customizing

Post#4 by inukaze » 23 Jul 2023, 04:59

i wrote another script for use fsck with the most partitions founds i put on /usr/bin/inufsck and apply chmod a+o+x /usr/bin/inufsck the content of my script is the follow

Code: Select all

#!/usr/bin/env bash

# Obtener todos los enlaces simbólicos en /dev/disk/by-uuid
# excepto los UUID de las particiones del pendrive :
# '23b2374a-ee65-49dc-9abd-562449624a68'
# 'a0784a07-12ba-4131-a646-726a70ad6a55'
# '38C0-FCD0'
# Usar NUL como separador de espacios funciona con
# cualquier nombre de archivo, incluidos los molestos
# caracteres como espacios o metacaracteres.
mapfile -d '' -t UUID < <(find /dev/disk/by-uuid/ -type l \
! -name '*23b2374a-ee65-49dc-9abd-562449624a68*' \
! -name '*a0784a07-12ba-4131-a646-726a70ad6a55*' \
! -name '*38C0-FCD0*' \
-print0)

# Entrar en bucle con esos enlaces simbólicos
for f in "${UUID[@]}" ; do
  # UUID sin ruta
  IDUU="${f/*\//}"

  # obtener la ruta real de los enlaces simbólicos
  rp="$(realpath "$f")"

  # Omitir aquellos que no son dispositivos de bloques
  [ -b "$rp" ] || continue

  # Ahora hacer lo que sea que necesite hacer con la variable "$rp"
  # Recuerda siempre usar doble-comilla para expandir las variables
  # 
  # Usar siempre printf en lugar de echo debido a que
  # echo no es confiable y se rompe fácilmente.
  # 
  printf "\nExaminando: %s (%s)\n" "$IDDU" "$rp"

  if fsck -fy "$rp" ; then
     if ! fsck -fy "$rp" ; then
       printf "%s\n" "Error en la segunda vez de fsck en $IDUU ($rp) Fallo." >&2
     fi
  else
    printf "%s\n" "Error: en la primera vez de fsck en $IDUU ($rp) fallo." >&2
  fi
done
Last edited by inukaze on 23 Jul 2023, 09:04, edited 1 time in total.

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

Porteus 5.0 USB Live - rc.local customizing

Post#5 by inukaze » 23 Jul 2023, 05:01

Well my rc.local the current content is :

Code: Select all

#!/bin/bash
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
echo ""
echo "/etc/rc.d/rc.local :"
#Iniciar gpm (Permite utilizar el raton en el modo tty)
if [ -f "/etc/rc.d/rc.gpm" ]; then
chmod +x "/etc/rc.d/rc.gpm"
"/etc/rc.d/rc.gpm"
fi

#========================================================================================================================================================
#========================================================================================================================================================
#========================================================================================================================================================
#
# INICIO de Montar Particiones de Disco Duro #
#Desmontar particiones (en caso de que estén montadas)

#/dev/sdc1: LABEL="Inukaze" UUID="38C0-FCD0" BLOCK_SIZE="512" TYPE="exfat" PARTUUID="29504791-01"
umount "/dev/disk/by-uuid/38C0-FCD0"	2>/dev/null #Partición «Inukaze» del pendrive
#/dev/sdc2: LABEL="Inicio" UUID="a0784a07-12ba-4131-a646-726a70ad6a55" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="29504791-02"
umount "/dev/disk/by-uuid/a0784a07-12ba-4131-a646-726a70ad6a55"	2>/dev/null #Partición «Inicio» del pendrive
#/dev/sdc3: LABEL="GNU_con_Linux" UUID="23b2374a-ee65-49dc-9abd-562449624a68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="29504791-03"
#umount /dev/disk/by-uuid/23b2374a-ee65-49dc-9abd-562449624a68	#Particion «GNU_Con_Linux» contiene Porteus, Modulos, etc . . .
LIGNUX=$(ls -la "/dev/disk/by-uuid/23b2374a-ee65-49dc-9abd-562449624a68" | tail -c5)

#Montar particiones Fijas (Las 3 del Pendrive son fijas) :
#Pendrive	#Partición «Inukaze» (La primera) del pendrive :
#Primero limpiar la partición exfat usando fsck.exfat
SDXX=$(ls -la "/dev/disk/by-uuid/38C0-FCD0" | tail -c5)
fsck.exfat -a "/dev/disk/by-uuid/38C0-FCD0"
mkdir -p "/mnt/$SDXX"
mount -t exfat -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show "/dev/disk/by-uuid/38C0-FCD0" "/mnt/$SDXX"
#
#========================================================================================================================================================
#
#Particiones Variables
#Disco Duro 700GB :
INTERCAMBIO=($(ls -l "/dev/disk/by-uuid" | grep '88ac777b-229e-4c23-af92-31dcbd008c53' | awk '{print $9}'))
if [ "$INTERCAMBIO" == "88ac777b-229e-4c23-af92-31dcbd008c53" ]; then
$(swapoff "/dev/disk/by-uuid/88ac777b-229e-4c23-af92-31dcbd008c53" ; sleep 3 ; swapon "/dev/disk/by-uuid/88ac777b-229e-4c23-af92-31dcbd008c53" ) &
fi

SLACKINI=($(ls -l "/dev/disk/by-uuid" | grep '28026719-c57b-4f9d-bd8d-81b28efade58' | awk '{print $9}'))
#
# Una variable no puede empezar por un numero o te devolverá el error «bash: syntax error near unexpected token `»
# En este caso si la variable fuera "$2SLACKINI", en la terminal veras que devuelve :
#  «bash: syntax error near unexpected token `$(ls -l /dev/disk/by-uuid | grep '28026719-c57b-4f9d-bd8d-81b28efade58' | awk '{print $9}')'»
#
if [ "$SLACKINI" == "28026719-c57b-4f9d-bd8d-81b28efade58" ]; then
#/dev/sd?3: LABEL="2SlackIni" UUID="28026719-c57b-4f9d-bd8d-81b28efade58" BLOCK_SIZE="4096" TYPE="ext2" PTUUID="4197a3bc" PTTYPE="dos" PARTUUID="3e59dc84-03"
SDXX=$(ls -la "/dev/disk/by-uuid/28026719-c57b-4f9d-bd8d-81b28efade58" | tail -c5)
mkdir -p "/mnt/$SDXX"
umount "/dev/disk/by-uuid/28026719-c57b-4f9d-bd8d-81b28efade58"	2>/dev/null	#Disco Duro de 700GB, Partición del GRUB Compartido.
mount -t ext2 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show "/dev/disk/by-uuid/28026719-c57b-4f9d-bd8d-81b28efade58" "/mnt/$SDXX" 2>/dev/null
ln -sf "/mnt/$SDXX" "/media/2SlackIni"
fi

SLACK32=($(ls -l "/dev/disk/by-uuid" | grep 'c8332c7a-b845-46bb-ab74-feaf3e6095f9' | awk '{print $9}'))
if [ "$SLACK32" == "c8332c7a-b845-46bb-ab74-feaf3e6095f9" ]; then
#/dev/sd?6: LABEL="Slack32" UUID="c8332c7a-b845-46bb-ab74-feaf3e6095f9" BLOCK_SIZE="4096" TYPE="ext3" PTTYPE="dos" PARTUUID="3e59dc84-06"
SDXX=$(ls -la "/dev/disk/by-uuid/c8332c7a-b845-46bb-ab74-feaf3e6095f9" | tail -c5)
mkdir -p "/mnt/$SDXX"
umount "/dev/disk/by-uuid/c8332c7a-b845-46bb-ab74-feaf3e6095f9" 2>/dev/null	#Disco Duro de 700GB, Partición de Lubuntu 22.04 Actualmente, antes de Slackware32 14.2
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show "/dev/disk/by-uuid/c8332c7a-b845-46bb-ab74-feaf3e6095f9" "/mnt/$SDXX" 2>/dev/null
ln -sf "/mnt/$SDXX" "/media/Slack32"
fi

SLACK64=($(ls -l "/dev/disk/by-uuid" | grep '22df6b3e-2a3a-467b-995e-4fdd08adcc68' | awk '{print $9}'))
if [ "$SLACK64" == "22df6b3e-2a3a-467b-995e-4fdd08adcc68" ]; then
#/dev/sd?5: LABEL="Slack64" UUID="22df6b3e-2a3a-467b-995e-4fdd08adcc68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="3e59dc84-05"
SDXX=$(ls -la "/dev/disk/by-uuid/22df6b3e-2a3a-467b-995e-4fdd08adcc68" | tail -c5)
mkdir -p "/mnt/$SDXX"
umount "/dev/disk/by-uuid/22df6b3e-2a3a-467b-995e-4fdd08adcc68" 2>/dev/null	#Disco Duro de 700GB, Partición de Slackware64 14.2. Distro Principal
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show "/dev/disk/by-uuid/22df6b3e-2a3a-467b-995e-4fdd08adcc68" "/mnt/$SDXX" 2>/dev/null
ln -sf "/mnt/$SDXX" "/media/Slack64"
fi

COMPARTIDO=($(ls -l "/dev/disk/by-uuid" | grep 'bb4117d3-816e-4061-ad50-3947ed396f68' | awk '{print $9}'))
if [ "$COMPARTIDO" == "bb4117d3-816e-4061-ad50-3947ed396f68" ]; then
SDXX=$(ls -la "/dev/disk/by-uuid/bb4117d3-816e-4061-ad50-3947ed396f68" | tail -c5)
#/dev/sd?1: LABEL="Compartido" UUID="bb4117d3-816e-4061-ad50-3947ed396f68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="3e59dc84-01"
mkdir -p "/mnt/$SDXX"
umount "/dev/disk/by-uuid/bb4117d3-816e-4061-ad50-3947ed396f68" 2>/dev/null	#Disco Duro de 700GB, Partición de Dato(s) «Compartido(s)»
mount -t ext3 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show "/dev/disk/by-uuid/bb4117d3-816e-4061-ad50-3947ed396f68" "/mnt/$SDXX" 2>/dev/null
ln -sf "/mnt/$SDXX" "/media/Compartido"
fi

#Disco Duro 320GB :
NICOLAS=($(ls -l "/dev/disk/by-uuid" | grep '7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5' | awk '{print $9}'))
if [ "$NICOLAS" == "7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5" ]; then
#/dev/sd?1: LABEL="Nicolas" UUID="7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="42091718-01"
SDXX=$(ls -la "/dev/disk/by-uuid/7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5" | tail -c5)
mkdir -p "/mnt/$SDXX"
umount "/dev/disk/by-uuid/7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5" 2>/dev/null	#Disco Duro de 320GB
mount -t ext4 -O rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show "/dev/disk/by-uuid/7f0c4f12-cc73-4e75-9c36-ea9d0b5b56a5" "/mnt/$SDXX" 2>/dev/null
ln -sf "/mnt/$SDXX" "/media/Nicolas"
fi

# FIN de Montar Particiones de Disco Duro #
#
#========================================================================================================================================================
#========================================================================================================================================================
#========================================================================================================================================================

#Forzar Sincronizar hora :
ntpdate=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b ntpdate | grep -i "ntpdate" | cut -d " " -f02 | cut -c11-20)
service=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b service | grep -i "service" | cut -d " " -f02 | cut -c11-20)
rcntpd="/etc/rc.d/rc.ntpd"

if [ -z "$ntpdate" ]; then
        echo
        echo "ntpdate no esta instalado en tu sistema operativo GNU"
        echo "Por favor, instale primero  ntpdate "
        echo
        exit 0
fi

#Slackware(64) :
if [ -d "/etc/rc.d" ];then
        if [ -f "$rcntpd" ]; then
                chmod +x "$rcntpd"
                2>/dev/null 1>/dev/null "$rcntpd" "stop" &> /dev/null
                rm "/etc/localtime"
                ln -sf "/usr/share/zoneinfo/America/Caracas" "/etc/localtime"
                echo ""
                CloudFlare=$(ping -c 1 1.1.1.1 | sed -n '5p' | cut -c 24-33)
                	if [ "$CloudFlare" == "1 received" ]; then
                			2>/dev/null 1>/dev/null "ntpdate" "pool.ntp.org" &> /dev/null
                			sleep 3
                			hwclock -w
                	fi                            
                2>/dev/null 1>/dev/null "$rcntpd" "start" &> /dev/null
                echo ""
        fi
fi

#========================================================================================================================================================
#========================================================================================================================================================
#========================================================================================================================================================
#

#========================================================================================================================================================
#========================================================================================================================================================
#========================================================================================================================================================
#
#Monturas CIFS :
# Para permitir eliminar archivos necesitas especificar file_mode=0777,dir_mode=0777,gid=1000,uid=1000 , el (g,u)id=1000 es del usuario guest
Geremia=$(ping -c 1 192.168.1.10 | sed -n '5p' | cut -c 24-33)

if [ "$Geremia" == "1 received" ]; then
#Primero crear carpetas para los puntos de montaje
mkdir -p "/media/cifs/Temporal"
mkdir -p "/media/cifs/Inukaze"
mkdir -p "/media/cifs/Inukaze-en-Familia"
mkdir -p "/media/cifs/Josmar"

$(mount -t cifs //192.168.1.10/Inukaze /media/cifs/Inukaze -o vers=1.0,username=inukaze,password=inukaze,uid=1000,gid=1000,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,domain=REDLOCAL) &
$(mount -t cifs //192.168.1.10/Inukaze-en-Familia /media/cifs/Inukaze-en-Familia -o vers=1.0,username=inukaze,password=inukaze,uid=1000,gid=1000,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,domain=REDLOCAL) &
$(mount -t cifs //192.168.1.10/Temporal /media/cifs/Temporal -o vers=1.0,username=inukaze,password=inukaze,uid=1000,gid=1000,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,domain=REDLOCAL) &
$(mount -t cifs //192.168.1.10/Josmar /media/cifs/Josmar -o vers=1.0,username=inukaze,password=inukaze,uid=1000,gid=1000,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,domain=REDLOCAL) &
fi

#========================================================================================================================================================
#========================================================================================================================================================
#========================================================================================================================================================
#
echo ""
cd "/mnt/live/tmp"
rm -rf "caches"
echo "Activar modulos adicionales que no quiero directamente en la ram :"
LIGNUX=$(ls -la "/dev/disk/by-uuid/23b2374a-ee65-49dc-9abd-562449624a68" | tail -c5)
MODULOS="/mnt/$LIGNUX/Porteus/Modulos-xzm" ; cd "$MODULOS"
#Qlipper
echo "Qlipper" ; mkdir -p "/mnt/live/tmp/caches" ; activate -q "./Salix/qlipper-20161212_14bfc66-x86_64-1salix15.0.xzm" 1>/dev/null 2>/dev/null ; rm -rf "/mnt/live/tmp/caches"
#Viewnior
echo "Viewnior" ; mkdir -p "/mnt/live/tmp/caches" ; activate -q "./Salix/viewnior/viewnior-1.7-x86_64-1gv__DEP-01__gtk+2-2.24.33-x86_64-2.xzm" 1>/dev/null 2>/dev/null ; activate -q "./Salix/viewnior/viewnior-1.7-x86_64-1gv__DEP-02__viewnior.xzm" 1>/dev/null 2>/dev/null ; rm -rf "/mnt/live/tmp/caches"
#Firefox
echo "Firefox" ; activate -q "./Porteus/firefox-115.0esr-x86_64-es-ES.xzm" 1>/dev/null 2>/dev/null ; rm -rf "/mnt/live/tmp/caches"
#Remmina
echo "Remmina" ; activate -q "./Ponce/remmina-1.4.27-x86_64-1-alldesktops.xzm" 1>/dev/null 2>/dev/null ; rm -rf "/mnt/live/tmp/caches"
#SMPlayer & VLC
echo "SMPlayer" ; activate -q "./Salix/smplayer-21.10.0-x86_64-1salix15.0.xzm" 1>/dev/null 2>/dev/null ; rm -rf "/mnt/live/tmp/caches"
echo "VLC"; activate -q "./Salix/vlc-3.0.17.3-x86_64-3salix15.0.xzm" 1>/dev/null 2>/dev/null ; rm -rf "/mnt/live/tmp/caches"
mkdir -p "/mnt/live/tmp/caches"
#Terminada la seccion de modulos adicional que no deben cargar directamente en la ram.

echo ""
Note on my path "/mnt/sda3/Porteus/Modulos", the modules are just symbolic links :
es-core_locales.xzm -> ../Modulos-xzm/Porteus/idioma-esp/es-core_locales.xzm
es-lxqt_locales.xzm -> ../Modulos-xzm/Porteus/idioma-esp/es-lxqt_locales.xzm
es_VE-locales-files.xzm -> ../Modulos-xzm/Porteus/idioma-esp/es_VE-locales-files.xzm
exfatprogs-1.1.3-x86_64-1.xzm -> ../Modulos-xzm/Official/exfatprogs-1.1.3-x86_64-1.xzm
exfat-utils-1.3.0-x86_64-1salix15.0.xzm -> ../Modulos-xzm/Salix/exFAT/exfat-utils-1.3.0-x86_64-1salix15.0.xzm
fuse-exfat-1.3.0-x86_64-2salix15.0.xzm -> ../Modulos-xzm/Salix/exFAT/fuse-exfat-1.3.0-x86_64-2salix15.0.xzm
glibc-i18n-2.33-x86_64-5.xzm -> ../Modulos-xzm/Porteus/idioma-esp/glibc-i18n-2.33-x86_64-5.xzm
gpm-1.20.7-x86_64-9.xzm -> ../Modulos-xzm/Official/gpm-1.20.7-x86_64-9.xzm
ntp-4.2.8p17-x86_64-1_slack15.0.xzm -> ../Modulos-xzm/Official/ntp-4.2.8p17-x86_64-1_slack15.0.xzm
Because the language spanish translations i must need edit

Original ~/.config/user-dirs.dirs content

Code: Select all

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
i must need change some values and rename folders on system. open a terminal :

Code: Select all

 #Primero renombrar carpetas :
cd "$HOME"
mv "$HOME/Desktop" "$HOME/Escritorio"
mv "$HOME/Downloads" "$HOME/Descargas"
mv "$HOME/Public" "$HOME/Público"
mv "$HOME/Documents" "$HOME/Documentos"
mv "$HOME/Music" "$HOME/Música"
mv "$HOME/Pictures" "$HOME/Imágenes"
mv "$HOME/Videos" "$HOME/Vídeos"

#Segundo reescribir el archivo "$HOME/.config/user-dirs.dirs"

echo '# Este archivo is escrito por xdg-user-dirs-update
# Si usted quiere cambiar o agregar directorios, solo edite la linea
# en la cual esta interesado. Todos los cambios seran retenidos para
# el proximo inicio.
#
# El Formato es XDG_xxx_DIR="$HOME/yyy", donde yyy 
# Format is XDG_xxx_DIR="$HOME/yyy", donde yyy es una ruta relativa
# al directorio hogar del usuario  con escape de shell ó
# XDG_xxx_DIR="/yyy", donde /yyy es una ruta# absoluta. 
# 
# Ningun otro formato esta soportado
#
XDG_DESKTOP_DIR="$HOME/Escritorio"
XDG_DOWNLOAD_DIR="$HOME/Descargas"
XDG_TEMPLATES_DIR="$HOME/Plantillas"
XDG_PUBLICSHARE_DIR="$HOME/Público"
XDG_DOCUMENTS_DIR="$HOME/Documentos"
XDG_MUSIC_DIR="$HOME/Música"
XDG_PICTURES_DIR="$HOME/Imágenes"
XDG_VIDEOS_DIR="$HOME/Vídeos"' | tee "$HOME/.config/user-dirs.dirs"

#No debo olvidar el de la localizacion idiomatica
cat "$HOME/.config/user-dirs.locale"
en_US

echo 'es_VE' | tee "$HOME/.config/user-dirs.locale"

xdg-user-dirs-update

Image

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

Porteus 5.0 USB Live - rc.local customizing

Post#6 by inukaze » 16 Aug 2023, 17:22

i publish and update version on this links of this forum :
[SOLVED] Pendrive with Partitions [SOLVED] (Post by inukaze #95238)

inukaze
Black ninja
Black ninja
Posts: 47
Joined: 06 Jul 2023, 07:40
Distribution: Slackware

Porteus 5.0 USB Live - rc.local customizing

Post#7 by inukaze » 02 Oct 2023, 13:53

i should remember this site, when i need search Slackware packages -> https://slackware.nl/slakfinder/index.php

Post Reply