Advertisement
Guest User

Untitled

a guest
Feb 18th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.29 KB | None | 0 0
  1. #!/bin/sh -e
  2. # For every user in /home/ ...
  3. for HOME_U in /home/*?; do
  4.  
  5. # Obtain the username
  6. USER=$( basename ${HOME_U} )
  7.  
  8. # In case the user is active (exists in /etc/shadow) ...
  9. if [ $( grep -c "${USER}:.*:.*:.*:.*:.*:::" /etc/shadow ) == 1 ] \
  10. && [ $( grep -c "${USER}:.*:.*:.*:.*:.*:/bin/.*sh" /etc/passwd ) == 1 ] \
  11. && [ -d ${HOME_U}/.config ] \
  12. && [ -d ${HOME_U} ]; then
  13.  
  14. # Making sure .config/your-package/ exists
  15. mkdir -p /home/${USER}/.config/synapse/
  16. mkdir -p /home/${USER}/.config/autostart/
  17. mkdir -p /home/${USER}/.config/Cardapio/
  18. mkdir -p /home/${USER}/.config/hotkeys/
  19. mkdir -p /home/${USER}/.gconf/apps/compiz-1/plugins/decor/screen0/options/
  20. # with appropiate permissions
  21. chown -R ${USER}:${USER} /home/${USER}/.config/synapse/
  22. chown -R ${USER}:${USER} /home/${USER}/.config/autostart/
  23. chown -R ${USER}:${USER} /home/${USER}/.config/Cardapio/
  24. chown -R ${USER}:${USER} /home/${USER}/.config/hotkeys/
  25. chown -R ${USER}:${USER} /home/${USER}/.gconf/apps/compiz-1/plugins/decor/screen0/options/
  26. # copy what we need
  27. cp /etc/skel/.config/synapse/config.json /home/${USER}/.config/synapse/config.json
  28. cp /etc/skel/.config/autostart/docky.desktop /home/${USER}/.config/autostart/docky.desktop
  29. cp /etc/skel/.config/autostart/synapse.desktop /home/${USER}/.config/autostart/synapse.desktop
  30. cp /etc/skel/.config/autostart/indicator-sysmonitor.desktop /home/${USER}/.config/autostart/indicator-sysmonitor.desktop
  31. cp /etc/skel/.config/Cardapio/config.json /home/${USER}/.config/Cardapio/config.json
  32. cp /etc/skel/.config/hotkeys/synapse.hotkeys /home/${USER}/.config/hotkeys/synapse.hotkeys
  33. cp /etc/skel/.gconf/apps/compiz-1/plugins/decor/screen0/options/%gconf.xml /home/${USER}/.gconf/apps/compiz-1/plugins/decor/screen0/options/%gconf.xml
  34.  
  35.  
  36. # with appropiate permissions
  37. chown ${USER}:${USER} /home/${USER}/.config/synapse/config.json
  38. chown ${USER}:${USER} /home/${USER}/.config/autostart/docky.desktop
  39. chown ${USER}:${USER} /home/${USER}/.config/autostart/synapse.desktop
  40. chown ${USER}:${USER} /home/${USER}/.config/autostart/indicator-sysmonitor.desktop
  41. chown ${USER}:${USER} /home/${USER}/.config/Cardapio/config.json
  42. chown ${USER}:${USER} /home/${USER}/.config/hotkeys/synapse.hotkeys
  43. chown ${USER}:${USER} /home/${USER}/.gconf/apps/compiz-1/plugins/decor/screen0/options/%gconf.xml
  44.  
  45. fi
  46. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement