Guest User

upgrade_to

a guest
Aug 7th, 2015
336
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. distro_new=vivid
  4. list=/dev/shm/list.txt
  5. list2=/dev/shm/list2.txt
  6. list_all=/dev/shm/list_all.txt
  7. list_install=/dev/shm/list_install.txt
  8.  
  9. upgrade_to=$1
  10. case $1 in
  11.   "") echo "upgrade by default to $distro_new"; upgrade_to=$distro_new;;
  12. esac
  13.  
  14. for yolist in $list $list2 $list_all $list_install
  15. do
  16.   test -e $yolist && rm $yolist
  17. done
  18.  
  19. grep $upgrade_to /var/lib/apt/lists/*Packages | grep "Package:" | awk '{print $2}' | sed "s/-lts-$upgrade_to//g" > $list
  20.  
  21. dpkg --get-selections | grep install > $list_all
  22.  
  23. for yolo in `cat $list`
  24. do
  25.   if [ "`grep $yolo $list_all`" ]; then
  26.     echo $yolo >> $list2
  27.   fi
  28. done
  29.  
  30. for yolo2 in `cat $list2`
  31. do
  32.   case $yolo2 in
  33.     *dbg) echo $yolo2 | sed "s/-dbg/-lts-$upgrade_to-dbg/" >> $list_install;;
  34.        linux-tools-common) echo $yolo2 | sed "s/linux-tools-common/linux-lts-$upgrade_to-tools-common/" >> $list_install;;
  35.        *) echo $yolo2 | sed "s/$/-lts-$upgrade_to/" >> $list_install;;
  36.   esac
  37. done
  38.  
  39.  
  40. sudo apt-get install `cat $list_install`
RAW Paste Data