runit-fstab-generator
Publicado por Perfil removido (última atualização em 20/06/2017)
[ Hits: 1.795 ]
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
Instalado novas interfaces no Ubuntu 12.04
Nenhum coment�rio foi encontrado.
Aprenda a Gerenciar Permissões de Arquivos no Linux
Como transformar um áudio em vídeo com efeito de forma de onda (wave form)
Como aprovar Pull Requests em seu repositório Github via linha de comando
Quebra de linha na data e hora no Linux Mint
Organizando seus PDF com o Zotero
tentando instalar em um notebook antigo o Linux LegacyOS_2023... [RESO... (9)
Problema com Conexão Outlook via Firewall (OpenSUSE) com Internet Fibr... (5)