wok-6.x annotate conky-theme-onsea/receipt @ rev 19068
conky-theme-onsea: take care on root in post_install
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 21 22:04:50 2016 +0200 (2016-04-21) |
parents | 26cea0618c07 |
children | 4bccb65c3f35 |
rev | line source |
---|---|
hackdorte@19066 | 1 # SliTaz package receipt. |
hackdorte@19066 | 2 |
hackdorte@19066 | 3 PACKAGE="conky-theme-onsea" |
hackdorte@19066 | 4 VERSION="0.1" |
hackdorte@19066 | 5 CATEGORY="x-window" |
hackdorte@19066 | 6 SHORT_DESC="A smooth theme for conky with smoke color." |
hackdorte@19066 | 7 MAINTAINER="hackdorte@sapo.pt" |
hackdorte@19066 | 8 LICENSE="PublicDomain" |
hackdorte@19066 | 9 SOURCE="onsea" |
hackdorte@19066 | 10 WEB_SITE="http://people.slitaz.org/~leonardolaporte" |
hackdorte@19066 | 11 STUFF_DIR="lab.slitaz/5.0/pkg/conky/1.9.0" |
hackdorte@19066 | 12 TARBALL="$SOURCE-$VERSION.tar.gz" |
hackdorte@19066 | 13 WGET_URL="${WEB_SITE}/$STUFF_DIR/$TARBALL" |
hackdorte@19066 | 14 TAGS="conky theme" |
hackdorte@19066 | 15 |
hackdorte@19066 | 16 DEPENDS="conky" |
hackdorte@19066 | 17 BUILD_DEPENDS="wget" |
hackdorte@19066 | 18 |
hackdorte@19066 | 19 BAK_DIR=".conky-backups" |
hackdorte@19066 | 20 BAK_FILE="DEwioa80aejskDFPels0" # I do not know how to improve it. I write it manually. There is an automatic method? |
hackdorte@19066 | 21 |
hackdorte@19066 | 22 # Rules to configure and make the package. |
hackdorte@19066 | 23 compile_rules() |
hackdorte@19066 | 24 { |
hackdorte@19066 | 25 mkdir -p $install/usr/share/conky/themes/$SOURCE |
hackdorte@19066 | 26 cp -a $src/.conkyrc $install/usr/share/conky/themes/$SOURCE/.conkyrc |
hackdorte@19066 | 27 } |
hackdorte@19066 | 28 |
hackdorte@19066 | 29 # Rules to gen a SliTaz package suitable for Tazpkg. |
hackdorte@19066 | 30 genpkg_rules() |
hackdorte@19066 | 31 { |
hackdorte@19066 | 32 cp -a $install/* $fs |
hackdorte@19066 | 33 } |
hackdorte@19066 | 34 |
hackdorte@19066 | 35 pre_install() |
hackdorte@19066 | 36 { |
hackdorte@19066 | 37 |
hackdorte@19066 | 38 # Build current ".conkyrc" backup. |
hackdorte@19066 | 39 |
pascal@19068 | 40 if [ -e $1/home/$USER/.conkyrc ]; then |
pascal@19068 | 41 mkdir -p $1/home/$USER/$BAK_DIR/$BAK_FILE |
pascal@19068 | 42 mv $1/home/$USER/.conkyrc $1/home/$USER/$BAK_DIR/$BAK_FILE |
hackdorte@19066 | 43 |
hackdorte@19066 | 44 # README (Alert file only). |
pascal@19068 | 45 cat > $1/home/$USER/$BAK_DIR/README <<EOT |
hackdorte@19066 | 46 |
hackdorte@19066 | 47 $PACKAGE Backup |
hackdorte@19066 | 48 ============================================== |
hackdorte@19066 | 49 $(date) |
hackdorte@19066 | 50 |
hackdorte@19066 | 51 Please do not remove this directory manually. |
hackdorte@19066 | 52 |
hackdorte@19066 | 53 Run: tazpkg remove $PACKAGE |
hackdorte@19066 | 54 |
hackdorte@19066 | 55 EOT |
hackdorte@19066 | 56 |
hackdorte@19066 | 57 else |
hackdorte@19066 | 58 echo "No .conkyrc file for backup."; |
hackdorte@19066 | 59 fi |
hackdorte@19066 | 60 |
hackdorte@19066 | 61 } |
hackdorte@19066 | 62 |
hackdorte@19066 | 63 post_install() |
hackdorte@19066 | 64 { |
hackdorte@19066 | 65 |
hackdorte@19066 | 66 # Install new ".conkyrc" to (home/user). |
hackdorte@19066 | 67 # And create a link to the original file. |
hackdorte@19066 | 68 |
pascal@19068 | 69 cd $1/home/$USER |
pascal@19068 | 70 ln -s /usr/share/conky/themes/$SOURCE/.conkyrc $1/home/$USER/.conkyrc |
pascal@19068 | 71 chmod 755 $1/home/$USER/.conkyrc |
hackdorte@19066 | 72 |
hackdorte@19066 | 73 # Check the conky process and run new theme. |
hackdorte@19066 | 74 |
pascal@19068 | 75 [ "$1" ] || |
hackdorte@19066 | 76 if busybox pidof conky >>/dev/null 2>&1; then |
hackdorte@19066 | 77 su - $USER -c "killall conky" && su - $USER -c "conky &"; |
hackdorte@19066 | 78 else |
hackdorte@19066 | 79 su - $USER -c "conky &"; |
hackdorte@19066 | 80 fi |
hackdorte@19066 | 81 |
hackdorte@19066 | 82 } |
hackdorte@19066 | 83 |
hackdorte@19066 | 84 pre_remove() |
hackdorte@19066 | 85 { |
hackdorte@19066 | 86 |
hackdorte@19066 | 87 # Restore old ".conkyrc" backup. |
hackdorte@19066 | 88 |
pascal@19068 | 89 if [ -e $1/home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc ]; then |
pascal@19068 | 90 mv $1/home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc $1/home/$USER |
pascal@19068 | 91 chmod 777 $1/home/$USER/.conkyrc |
pascal@19068 | 92 rm -rf $1/home/$USER/$BAK_DIR/$BAK_FILE |
pascal@19068 | 93 rm -rf $1/home/$USER/$BAK_DIR/README |
hackdorte@19066 | 94 else |
hackdorte@19066 | 95 echo "Empty! No backup files."; |
hackdorte@19066 | 96 fi |
hackdorte@19066 | 97 |
hackdorte@19066 | 98 } |
hackdorte@19066 | 99 |
hackdorte@19066 | 100 post_remove() |
hackdorte@19066 | 101 { |
hackdorte@19066 | 102 |
hackdorte@19066 | 103 # Check the conky process and run old theme. |
hackdorte@19066 | 104 |
pascal@19068 | 105 [ "$1" ] || |
hackdorte@19066 | 106 if busybox pidof conky >>/dev/null 2>&1; then |
hackdorte@19066 | 107 su - $USER -c "killall conky" && su - $USER -c "conky &"; |
hackdorte@19066 | 108 else |
hackdorte@19066 | 109 su - $USER -c "conky &"; |
hackdorte@19066 | 110 fi |
hackdorte@19066 | 111 |
hackdorte@19066 | 112 } |