,backup_wallpaper.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # Coding: utf-8
  3. # Editor: www.geany.org
  4. # Created 2018-04-30
  5. #_sudo_apt_install_ steghide zenity
  6. source $HOME/.SCR/lib.sh
  7. echo "1 arg - pic_fullpath"
  8. echo "2 arg - date_fullpath"
  9. if (( "$#" < 2))
  10. then
  11. pic_fullpath=`zenity --file-selection --title="Select pic_fullpath"`
  12. fun_echo_variable pic_fullpath
  13. date_fullpath=`zenity --file-selection --title="Select date_fullpath"`
  14. fun_echo_variable date_fullpath
  15. else
  16. pic_fullpath="$1"
  17. date_fullpath="$2"
  18. fi
  19. dir_wp="$HOME/DATA2/Wallpapers/android"
  20. read hash_bw < "$HOME/.ssh/hash_bw"
  21. read -s -p "Enter password:" pass
  22. hash="$(echo "$pass" | sha256sum | cut -c -8)"
  23. if [ "$hash" == "$hash_bw" ]
  24. then
  25. fun_create_directory "$dir_wp"
  26. cd "$dir_wp"
  27. new_pic_filename="$(basename "$pic_fullpath")"
  28. fun_echo_variable dir_wp hash_bw hash pic_fullpath date_fullpath new_pic_filename
  29. rm -rf "$dir_wp/$new_pic_filename"
  30. steghide embed -ef "$date_fullpath" -p "$pass" -cf "$pic_fullpath" -sf "$new_pic_filename"
  31. if [ "$?" -eq "0" ] # если кода возврата 0
  32. then
  33. date_pic_file="$(stat "$new_pic_filename" | grep "Modify" | cut -f2-4 -d" ")"
  34. find . -exec touch -a --date="$date_pic_file" {} \;
  35. find . -exec touch -m --date="$date_pic_file" {} \;
  36. fi
  37. fun_for_continue_enter_password
  38. touch "/tmp/backup_wallpaper_0"
  39. else
  40. echo "$hash_bw not correct"
  41. fi