Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- main_url='https://raw.github.com/psi-plus/contentdownloader/master/content.list'
- main_path='/usr/share/psi-plus'
- list_path='/tmp/content.list'
- if ! wget -qO $list_path $main_url --no-check-certificate ; then echo "Can't get file list"; exit 1; fi
- if ! cd $main_path ; then echo "Can't change directory to $main_path"; exit 2; fi
- if ! [ -w . ] ; then echo "$main_path is read only"; exit 3; fi
- cat $list_path|grep -n '\['|while read line; do
- path="$(echo $line|cut -d ':' -f 2|sed 's/\[//;s/\]//')"
- current_line="$(echo $line|cut -d ':' -f 1)";
- url_line=$(($current_line+2))
- name_line=$(($current_line+1))
- type=$(echo $path|cut -d '/' -f 2)
- name="$(cat $list_path|sed -n ${name_line}p|cut -d '=' -f 2)"
- url="$(cat $list_path|sed -n ${url_line}p|cut -d '=' -f 2)"
- file=$(basename $url)
- echo "Saving $name ($type) to $path/$file..."
- mkdir -p $path
- wget -qO $path/$file $url --no-check-certificate
- done
Advertisement
Add Comment
Please, Sign In to add comment