Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- vars='?C=N;O=D'
- mainline=http://kernel.ubuntu.com/~kernel-ppa/mainline/
- arch=amd64
- rm -r /tmp/k /tmp/md /tmp/mt 2>/dev/null
- wget -O- ${mainline}$vars > /tmp/k
- if [ -s /tmp/k ]
- then distrgx='/href=/{s/\(^.*href="\)\(v[^"]\+[a-z]\/\)\(".*\)/\2/p;}'
- tiprgx='/href=/{s/\(^.*href="\)\(v[^"]\+\/\)\(".*\)/\2/p;}'
- patrgx='s/\(^.*href="\)\([0-9].*\.patch\)\(".*$\)/\2/p'
- d=`sed -n -e $distrgx /tmp/k | head -n1`
- t=`sed -n -e $tiprgx /tmp/k | head -n1`
- echo d $d t $t
- wget -O- ${mainline}$d > /tmp/md
- wget -O- ${mainline}$t > /tmp/mt
- if [ -s /tmp/md ] && [ -s /tmp/mt ]
- then tpatches=( `sed -n -e $patrgx /tmp/mt | sort | uniq` )
- for (( n=0 ; n<${#tpatches[@]} ; n++ ))
- do tpatches[$n]=${mainline}${t}${tpatches[$n]}
- done
- deb='/href=/{/generic/{/'$arch'/{/image/s/\(^.*href="\)\([^"]\+\)\(".*\)/\2/p;};};}'
- headers='/href=/{/generic/{/'$arch'/{/headers/s/\(^.*href="\)\([^"]\+\)\(".*\)/\2/p;};};}'
- allhdrs='/href=/{/all/{/headers/s/\(^.*href="\)\([^"]\+\)\(".*\)/\2/p;};}'
- dist=${mainline}${d}`sed -n -e $deb /tmp/md | tail -n1`
- distheaders=${mainline}${d}`sed -n -e $headers /tmp/md | tail -n1`
- alld=${mainline}${d}`sed -n -e $allhdrs /tmp/md | tail -n1`
- tip=${mainline}${t}`sed -n -e $deb /tmp/mt | tail -n1`
- tipheaders=${mainline}${t}`sed -n -e $headers /tmp/mt | tail -n1`
- allt=${mainline}${t}`sed -n -e $allhdrs /tmp/mt | tail -n1`
- echo dist $dist
- echo distheaders $distheaders prereq all $alld
- echo tip $tip
- echo tipheaders $tipheaders prereq all $allt
- mkdir -p ~/Downloads/mainline
- pushd ~/Downloads/mainline 2>/dev/null
- rm *.deb *.patch # install headers first for grub mkinitramfs
- for f in $alld $distheaders $dist $allt $tipheaders $tip ${tpatches[@]}
- do ff=`echo $f | sed -e 's/^.*\///'`
- [ -s "$ff" ] || wget $f
- [ -n "$ff" ] && [ -f $ff ] && [ -s $ff ] && \
- [ $ff != ${ff%.deb} ] && sudo dpkg -i $ff
- done
- popd 2>/dev/null
- fi
- fi
- rm -r /tmp/k /tmp/md /tmp/mt 2>/dev/null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement