runit-fstab-generator
Publicado por Perfil removido (última atualização em 20/06/2017)
[ Hits: 1.933 ]
Download runit-fstab-generator
Faz parsing do /etc/fstab e produz scripts pra montar as partições encontradas.
- ignora a partição root.
- ignora partições que tem noauto nas opções.
- cria os arquivos em /run/runit/rc.d/mount-$local_onde_e_montado.rc
- faz uso do lodewijk para garantir paralelização da montagem das partições.
- cria arquivo mounts.target em /run/runit/rc.d , que pode ser usado para rodar todos os scripts gerados
#!/bin/sh
#
# Convert fstab entries into run files for mount
# depends on lodewijk and can't define dependencies
# it requires the dir /run/rc.d to be created and writable
#
# files created:
# /run/runit/rc.d/mounts.target --> this is a script that keeps a list
# of mounts and executes them with lodewijk
# /run/runit/rc.d/$mount.rc --> this is a run file for a mount, the
# name is mount-[basename of path on fstab].rc
# mount.rc files that are not on tmpfs automatically depend on
# mount-rw.rc
[ "$(id -u)" != "0" ] && exit 128
set -eu
create_run() {
(
printf "%s\\n%s\\n\\n" "#!/bin/sh" "set -eu"
if [ "$1" != "tmpfs" ]; then
printf "%s\\n\\n" "lodewijk mount-rw.rc"
fi
printf "%s\\n" "echo \"mounting $2 ...\""
printf "%s" "exec mount "
if [ "$1" = "tmpfs" ]; then
printf "%s" "-t $1 "
fi
if [ ! -z "$4" ]; then
printf "%s" "-o $4 "
fi
if [ "$1" != "tmpfs" ]; then
printf "%s" "$1 "
fi
printf "%s\\n" "$2"
) > /run/runit/rc.d/mount-"$(echo $2 | grep -o '[^/]*$').rc"
chmod +x /run/runit/rc.d/mount-"$(echo $2 | grep -o '[^/]*$').rc"
}
printf "%s\\n%s\\n\\n" "#!/bin/sh" "set -eu" > /run/runit/rc.d/mounts.target
chmod +x /run/runit/rc.d/mounts.target
grep -v '^#' < /etc/fstab | while IFS= read -r mount; do
# Separate each arg into it's own
disk="$(echo $mount|cut -d' ' -f1)"
location="$(echo $mount|cut -d' ' -f2)"
filesystem="$(echo $mount|cut -d' ' -f3)"
# If the fstab mentions no auto, then we don't generate a run unit to mount
opts="$(echo $mount|cut -d' ' -f4)"
if (echo $opts | grep -q noauto); then
continue
fi
# We don't want to remount the root partition
[ "$location" = "/" ] && continue
# We now call a function to create a run file
create_run "$disk" "$location" "$filesystem" "$opts"
# We add it to mounts.target
printf "%s\\n" "lodewijk mount-$(echo $location | grep -o '[^/]*$').rc" >> /run/runit/rc.d/mounts.target
done
MRTG Start | Stop | Status | Restart
Script de instalação do Mplayer, com todas as fontes e codecs
verificar acessos indevidos automaticamente squid
Nenhum comentário foi encontrado.
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Como realizar um ataque de força bruta para desobrir senhas?
Como usar Gpaste no ambiente Cinnamon
Atualizando o Fedora 42 para 43
SQLITE não quer funcionar no LINUX LMDE6 64 com Lazaruz 4.2 64bit (n... (0)
Secure boot, artigo interessante, nada técnico. (5)
VOL já não é mais como antes? (9)
É normal não gostar de KDE? (13)
E aí? O Warsaw já está funcionando no Debian 13? [RESOLVIDO] (15)









