wok rev 19066

It works, but needs review and improvement. Thank you.
author Leonardo Laporte <hackdorte@sapo.pt>
date Thu Apr 21 06:32:59 2016 -0300 (2016-04-21)
parents 15e6c6910ee3
children 26cea0618c07
files conky-theme-onsea/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/conky-theme-onsea/receipt	Thu Apr 21 06:32:59 2016 -0300
     1.3 @@ -0,0 +1,110 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="conky-theme-onsea"
     1.7 +VERSION="0.1"
     1.8 +CATEGORY="x-window"
     1.9 +SHORT_DESC="A smooth theme for conky with smoke color."
    1.10 +MAINTAINER="hackdorte@sapo.pt"
    1.11 +LICENSE="PublicDomain"
    1.12 +SOURCE="onsea"
    1.13 +WEB_SITE="http://people.slitaz.org/~leonardolaporte"
    1.14 +STUFF_DIR="lab.slitaz/5.0/pkg/conky/1.9.0"
    1.15 +TARBALL="$SOURCE-$VERSION.tar.gz"
    1.16 +WGET_URL="${WEB_SITE}/$STUFF_DIR/$TARBALL"
    1.17 +TAGS="conky theme"
    1.18 +
    1.19 +DEPENDS="conky"
    1.20 +BUILD_DEPENDS="wget"
    1.21 +
    1.22 +BAK_DIR=".conky-backups"
    1.23 +BAK_FILE="DEwioa80aejskDFPels0" # I do not know how to improve it. I write it manually. There is an automatic method?
    1.24 +
    1.25 +# Rules to configure and make the package.
    1.26 +compile_rules()
    1.27 +{
    1.28 +  mkdir -p $install/usr/share/conky/themes/$SOURCE
    1.29 +  cp -a $src/.conkyrc $install/usr/share/conky/themes/$SOURCE/.conkyrc
    1.30 +}
    1.31 +
    1.32 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.33 +genpkg_rules()
    1.34 +{
    1.35 +  cp -a $install/* $fs
    1.36 +}
    1.37 +
    1.38 +pre_install()
    1.39 +{
    1.40 +
    1.41 +# Build current ".conkyrc" backup.
    1.42 +
    1.43 +if [ -e /home/$USER/.conkyrc ]; then
    1.44 +mkdir -p /home/$USER/$BAK_DIR/$BAK_FILE
    1.45 +mv /home/$USER/.conkyrc /home/$USER/$BAK_DIR/$BAK_FILE
    1.46 +
    1.47 +# README (Alert file only).
    1.48 +cat > /home/$USER/$BAK_DIR/README <<EOT
    1.49 +
    1.50 +  $PACKAGE Backup
    1.51 +  ==============================================
    1.52 +  $(date)
    1.53 +
    1.54 +  Please do not remove this directory manually.
    1.55 +
    1.56 +  Run: tazpkg remove $PACKAGE
    1.57 +
    1.58 +EOT
    1.59 +
    1.60 +else
    1.61 +  echo "No .conkyrc file for backup.";
    1.62 +fi
    1.63 +
    1.64 +}
    1.65 +
    1.66 +post_install()
    1.67 +{
    1.68 +
    1.69 +# Install new ".conkyrc" to (home/user).
    1.70 +# And create a link to the original file.
    1.71 +
    1.72 +  cd /home/$USER
    1.73 +  ln -s /usr/share/conky/themes/$SOURCE/.conkyrc .conkyrc
    1.74 +  chmod u+r /home/$USER/.conkyrc
    1.75 +
    1.76 +# Check the conky process and run new theme.
    1.77 +
    1.78 +  if busybox pidof conky >>/dev/null 2>&1; then
    1.79 +    su - $USER -c "killall conky" && su - $USER -c "conky &";
    1.80 +  else
    1.81 +    su - $USER -c "conky &";
    1.82 +  fi
    1.83 +
    1.84 +}
    1.85 +
    1.86 +pre_remove()
    1.87 +{
    1.88 +
    1.89 +# Restore old ".conkyrc" backup.
    1.90 +
    1.91 +  if [ -e /home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc ]; then
    1.92 +    mv /home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc /home/$USER
    1.93 +    chmod 777 /home/$USER/.conkyrc
    1.94 +    rm -rf /home/$USER/$BAK_DIR/$BAK_FILE
    1.95 +    rm -rf /home/$USER/$BAK_DIR/README
    1.96 +  else
    1.97 +    echo "Empty! No backup files.";
    1.98 +  fi
    1.99 +
   1.100 +}
   1.101 +
   1.102 +post_remove()
   1.103 +{
   1.104 +
   1.105 +# Check the conky process and run old theme.
   1.106 +
   1.107 +  if busybox pidof conky >>/dev/null 2>&1; then
   1.108 +    su - $USER -c "killall conky" && su - $USER -c "conky &";
   1.109 +  else
   1.110 +    su - $USER -c "conky &";
   1.111 +  fi
   1.112 +
   1.113 +}