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