Save it as '/usr/bin/update_module' or whatever, and make executable: 'chmod +x /usr/bin/update_module'.
run as follows:
'update_module /path/to_module.lzm'
Code: Select all
#!/bin/sh
#script by fanthom
# Variables
mod=`readlink -f $1`
dest=/tmp/update_module$$
path=`echo $mod | rev | cut -d/ -f2- | rev`
c='\e[36m'
r='\e[31m'
e=`tput sgr0`
# Let's start
if [ "$1" = "" ]; then
echo && echo -e "${r}need a lzm module as an argument
examples:
$0 module.lzm
$0 /mnt/sda2/porteus/modules/configs.lzm"$e
exit
fi
echo && echo -e "${c}provide new name for your module without .lzm at the end"$e
read name
echo && echo -e "${c}wait a while..."$e
mkdir $dest
for x in `unsquashfs -l $mod | cut -b 14- | sed '4,/*/ !d'`; do
cp -P --parents $x $dest 2> /dev/null
done
dir2lzm $dest $path/$name.lzm
rm -r $dest
echo && echo -e "${c}updated module created as $path/$name.lzm"$e