home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / importfrompuppy1 < prev    next >
Encoding:
Text File  |  2006-05-16  |  5.0 KB  |  170 lines

  1. #!/bin/sh
  2. # script to import from puppy1 to puppy2.
  3.  
  4. echo "This script will import installed packages and personal files from a"
  5. echo "pupxxx file (the personal storage file used by Puppy 1.x.x) to Puppy2."
  6. echo "But, you have to know the partition in which it resides."
  7. echo
  8. echo "here are the partitions in the PC:"
  9. PCPARTS="`probepart | grep '^/dev/' | sed -e 's/none|.*NTFS.*/ntfs|/g' | cut -f 1-2 -d '|' | grep --extended-regexp 'ntfs|msdos|vfat|ext2|ext3|reiserfs|minix'`"
  10. echo "0  abort-exit-quit"
  11. CNTPARTS=1
  12. CHOICES="`echo -n "$PCPARTS" | tr "\n" " "`"
  13. for ONEPART in $CHOICES
  14. do
  15.  echo "$CNTPARTS  $ONEPART"
  16.  CNTPARTS=`expr $CNTPARTS + 1`
  17. done
  18. echo -n "Please type a number then press ENTER key: "
  19. read CHOSENNUM
  20. [ $CHOSENNUM -eq 0 ] && exit
  21. CHOSENPART="`echo -n "$CHOICES" | cut -f $CHOSENNUM -d " "`"
  22.  
  23. echo
  24. echo "You have chosen $CHOSENPART"
  25. INPART="`echo -n "$CHOSENPART" | cut -f 1 -d '|' | cut -f 3 -d '/'`"
  26. INFS="`echo -n "$CHOSENPART" | cut -f 2 -d '|'`"
  27. MNTPT="`mount | grep /dev/$INPART | tr -s " " | cut -f 3 -d " "`"
  28. if [ "$MNTPT" = "" ];then
  29.  mount -t $INFS /dev/$INPART /mnt/$INPART
  30.  MNTPT="/mnt/$INPART"
  31. fi
  32.  
  33. echo
  34. echo "Here are the found pupxxx files:"
  35. PUPFILES="`find /mnt/$INPART -maxdepth 1 -name pup???`"
  36. echo "0  abort-exit-quit"
  37. CNTPARTS=1
  38. CHOICES="`echo -n "$PUPFILES" | tr "\n" " "`"
  39. for ONEPUP in $CHOICES
  40. do
  41.  echo "$CNTPARTS  $ONEPUP"
  42.  CNTPARTS=`expr $CNTPARTS + 1`
  43. done
  44. echo -n "Please type a number then press ENTER key: "
  45. read CHOSENNUM
  46. [ $CHOSENNUM -eq 0 ] && exit
  47. CHOSENPUP="`echo -n "$CHOICES" | cut -f $CHOSENNUM -d " "`"
  48.  
  49. echo
  50. echo "You have chosen $CHOSENPUP"
  51.  
  52. losetup /dev/loop2 $CHOSENPUP
  53. mkdir /tmp/chosenpupmntpt 2>/dev/null
  54. mount -t ext2 /dev/loop2 /tmp/chosenpupmntpt
  55.  
  56. echo
  57. echo "Now probing for installed PupGet packages and DotPups that are"
  58. echo "registered with the PupGet package manager."
  59. echo "Note, it is recommended that you do not import these, and instead"
  60. echo "reinstall them in Puppy2."
  61. PUPGETFILES="`ls -1 /tmp/chosenpupmntpt/root/.packages/*.files 2> /dev/null`"
  62. for APUPGETFILE in $PUPGETFILES
  63. do
  64.  APACKAGE="`basename $APUPGETFILE | sed -e 's/\.files//g'`"
  65.  echo
  66.  echo -n "Do you want to import package ${APACKAGE}? y|n: "
  67.  read ASKYESNO
  68.  if [ "$ASKYESNO" = "y" ];then
  69.   cat $APUPGETFILE |
  70.   while read ONEFILE
  71.   do
  72.    echo "Copying ${ONEFILE}..."
  73.    ONEDIR="`dirname $ONEFILE`"
  74.    mkdir -p $ONEDIR
  75.    cp -a --remove-destination /tmp/chosenpupmntpt${ONEFILE} ${ONEDIR}/
  76.   done
  77.   PKGFILES="`ls -1 /tmp/chosenpupmntpt/root/.packages/${APACKAGE}.* 2> /dev/null`"
  78.   for ONEPKGFILE in $PKGFILES
  79.   do
  80.    echo "Copying ${ONEPKGFILE}..."
  81.    cp -af $ONEPKGFILE /root/.packages/
  82.   done
  83.   if [ -f /root/.packages/${APACKAGE}.keyword ];then
  84.    echo "Updating $KEYWORD in w.m. menus..."
  85.    KEYWORD="`cat /root/.packages/${APACKAGE}.keyword | cut -f 1 -d " "`"
  86.    /usr/sbin/fixmenus /root +$KEYWORD
  87.   fi
  88.  fi
  89. done
  90.  
  91. echo
  92. echo "File $CHOSENPUP is mounted on /tmp/chosenpupmntpt."
  93. echo "The trickiest part of importing is to get all the right stuff"
  94. echo "out of your old home directory, /tmp/chosenpupmntpt/root."
  95. echo "This section of the script is not complete, feedback welcome."
  96.  
  97. if [ -s /root/.events ];then
  98.  echo
  99.  echo -n "Import Agenda event manager data? y|n: "
  100.  read nnnn
  101.  if [ "$nnnn" = "y" ];then
  102.   echo "Importing /root/.events, .events.log..."
  103.   cp -af /tmp/chosenpupmntpt/root/.events /root/
  104.   cp -af /tmp/chosenpupmntpt/root/.events.log /root/
  105.  fi
  106. fi
  107.  
  108. if [ -d /root/.gaim ];then
  109.  echo
  110.  echo -n "Import Gaim account settings? y|n: "
  111.  read nnnn
  112.  if [ "$nnnn" = "y" ];then
  113.   echo "Copying /tmp/chosenpupmntpt/root/.gaim..."
  114.   cp -af /tmp/chosenpupmntpt/root/.gaim /root/
  115.  fi
  116. fi
  117.  
  118. if [ -d /root/.LinNeighborhood ];then
  119.  echo
  120.  echo -n "Import LinNeighborhood settings? y|n: "
  121.  read nnnn
  122.  if [ "$nnnn" = "y" ];then
  123.   echo "Copying /tmp/chosenpupmntpt/root/.LinNeighborhood..."
  124.   cp -af /tmp/chosenpupmntpt/root/.LinNeighborhood /root/
  125.  fi
  126. fi
  127.  
  128. if [ -d /root/.mozilla ];then
  129.  echo
  130.  echo "Puppy2 has Seamonkey, not Mozilla."
  131.  echo "Anything you want to import, please use Rox to drag from"
  132.  echo "/tmp/chosenpupmntpt/root/.mozilla to /root/.mozilla"
  133.  echo "anything that is relevant."
  134.  echo "This script cannot do this automatically yet."
  135.  echo -n "Press ENTER to continue: "
  136.  read nnnn
  137. fi
  138.  
  139. echo
  140. echo "Do you have any DotPups installed in"
  141. echo "/tmp/chosenpupmntpt/root/my-roxapps?"
  142. echo "Then open Rox and drag them across to /root/my-roxapps."
  143. echo -n "Press ENTER to continue: "
  144. read nnnn
  145.  
  146. echo
  147. echo "This release of Puppy2 does not have Sylpheed email program."
  148. echo "It is a PupGet package and you can install it."
  149. echo "If you wish, you can copy all the settings and mail from"
  150. echo "Puppy1. use Rox to drag /tmp/chosenpupmntpt/root/.sylpheed-2.0"
  151. echo "and /tmp/chosenpupmntpt/root/Mail to /root."
  152. echo -n "Press ENTER to continue: "
  153. read nnnn
  154.  
  155. echo
  156. echo "That's it. Anything else you can think to copy over, do so now."
  157. echo -n "Press ENTER to unmount ${CHOSENPUP}: "
  158. read nnnn
  159.  
  160. sync
  161. umount /tmp/chosenpupmntpt
  162. rmdir /tmp/chosenpupmntpt
  163. umount $MNTPT 2>/dev/null
  164.  
  165. echo
  166. echo -n "Press ENTER key to end script: "
  167. read nnnn
  168.  
  169. ###END###
  170.