Eu criei o script a seguir, caso alguém esteja interessado.
O script monta um compartilhamento de samba no sistema de arquivos local, executa o apt-mirror e desmonta o compartilhamento de samba quando ele é concluído.
Este é praticamente o meu primeiro script, então tenho certeza que há muito espaço para melhorias
#!/bin/bash
# This scripts expects cifs-utils installed and apt-mirror
# installed and configured, and all samba shares properly configured
######### Variables Definition ##############
mountDir='/mnt/apt-mirrors'
sambaShare="//myserver/apt-mirrors"
sambaUser="myUser"
sambaPwd="mySambaPassword"
######### End Variables Definition ##########
clear
echo
echo "********** Starting Execution **********"
echo
if [ ! -d $mountDir ]; then
echo "creating dir: $mountDir.."
mkdir $mountDir
echo "$mountDir created"
else
echo "dir $mountDir exists"
fi
mounted () {
eval "grep -qs $mountDir /proc/mounts"
}
echo
if mounted; then
echo "something is mounted in $mountDir. Unmounting..."
umount -f $mountDir
echo
fi
echo "mounting share $sambaShare in dir $mountDir..."
mount -t cifs -o username=$sambaUser,password=$sambaPwd $sambaShare $mountDir
if mounted; then
echo "samba share $sambaShare successfuly mounted"
echo
echo "********* starting apt-mirror **********"
echo
(exec /usr/bin/apt-mirror)
echo
echo "********* apt-mirror finished **********"
echo
echo "unmounting $mountDir"
umount -l $mountDir
fi
echo
if ! mounted; then
echo "unmount successful"
else
echo "something went wrong: $sambaShare is still mounted"
echo "forcing unmount..."
umount -f $mountDir
fi
echo
echo "cleaning $mountDir..."
rm -r $mountDir
echo
echo "********** Execution Finished **********"
exit
Você pode substituir os valores das variáveis para atender às suas necessidades