wok view get-community-backgrounds/stuff/get-community-backgrounds @ rev 23689

updated sysstat (12.1.7 -> 12.3.2)
author Hans-G?nter Theisgen
date Sun Apr 26 17:56:55 2020 +0100 (2020-04-26)
parents d95ae0b39830
children
line source
1 #!/bin/sh
2 #
3 # get-community-backgrounds - create and install SliTaz package community-backgrounds
4 #
5 # (C) 2020 SliTaz - GNU General Public License v3.
6 # Author : Leonardo Laporte
7 # modified by HGT on 2020-02-10
8 #
10 # === Initialisations ===
12 PKGS_DB="/var/lib/tazpkg" # packages database directory
14 PACKAGE="community-backgrounds"
15 VERSION="001"
16 CATEGORY="x-window"
17 TAGS="artwork background wallpaper"
18 SHORT_DESC="Beautiful wallpapers created by the Slitaz Community."
19 MAINTAINER="hackdorte@sapo.pt"
20 LICENSE="BSD"
21 WEB_SITE="https://github.com/Slitaz-official/hackdorte-artwork"
23 # Declare functions check_root, status, ...
24 . /lib/libtaz.sh
25 # and make commandline options (if any) available as variables
27 [ -f '/etc/slitaz/slitaz.conf' ] && . /etc/slitaz/slitaz.conf
29 is_installed()
30 {
31 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
32 then #package is deemed to be installed
33 return 0
34 else
35 return 1
36 fi
37 }
39 # Show commandline options, if requested by --help
40 if [ "$help" == "yes" ]
41 then
42 echo "Commandline options:
43 $0
44 --root=<path-to-root>
45 --install=yes|no
46 --keep=no|yes
47 --tmpdir=<directory-to-build-package>"
48 exit
49 fi
51 # Check for system administrator privileges
52 check_root
54 title "Package $PACKAGE will be build as SliTaz package and installed"
56 # Install SliTaz package, unless inhibited by option --install=no
57 [ -z "$install" ] && install="yes"
59 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
60 # unless option --keep=yes is given
61 [ -z "$keep" ] && keep="no"
63 # Directory for temporary files
64 TMP_DIR="$tmpdir"
65 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
67 # Logging file (unused by now)
68 LOG=$TMP_DIR/get-$PACKAGE.log
70 cat <<EOT
71 Options in use:
72 root : $root/
73 install package: $install
74 keep tazpkg : $keep
75 build directory: $TMP_DIR
77 EOT
79 separator
80 newline
82 # === Remove package, if installed ===
83 if is_installed
84 then
85 action "Removing installed version..."
86 newline
87 tazpkg remove $PACKAGE --root="$root/"
88 [ ! is_installed ] &&
89 die "Can't remove installed version. Exiting."
90 fi
92 # === Fetch archive file, if not existing ===
93 FILE="master.zip"
94 WGET_URL="${WEB_SITE}/archive/$FILE"
96 CUR_DIR=$(pwd)
97 mkdir -p $TMP_DIR
98 cd $TMP_DIR
99 if [ -f $FILE ]
100 then
101 echo "Using existing archive file $FILE"
102 else
103 action "Fetching the archive"
104 newline
105 wget --no-check-certificate $WGET_URL
106 if [ ! -f $FILE ]
107 then
108 cd $CUR_DIR
109 rm -rf $TMP_DIR
110 echo "Could not transfer $FILE from $WGET_URL. Exiting."
111 exit 1
112 fi
113 fi
115 # === Extract files from archive ===
116 action "Extracting the archive"
117 newline
118 busybox unzip -o $FILE
119 status
121 # Remove archive file
122 rm -f $FILE
124 # Building Base
125 mkdir -p $PACKAGE-$VERSION/fs/usr/share/images
126 mv hackdorte-artwork-master/images/* \
127 $PACKAGE-$VERSION/fs/usr/share/images
129 action "Cleaning..."
130 rm -rf $PACKAGE-$VERSION/fs/usr/share/images/README.md
131 rm -rf hackdorte-artwork-master
132 status
134 # Create recipe for SliTaz package
135 cat > $PACKAGE-$VERSION/receipt <<EOT
136 # SliTaz package receipt.
138 PACKED_SIZE=""
139 UNPACKED_SIZE=""
140 PACKAGE="$PACKAGE"
141 VERSION="$VERSION"
142 CATEGORY="$CATEGORY"
143 TAGS="$TAGS"
144 SHORT_DESC="$SHORT_DESC"
145 MAINTAINER="$MAINTAINER"
146 LICENSE="$LICENSE"
147 WEB_SITE="$WEB_SITE"
149 EOT
151 action "Creating the package $PACKAGE..."
152 tazpkg pack $PACKAGE-$VERSION
153 # Remove package tree
154 rm -rf $PACKAGE-$VERSION
156 # === Install the SliTaz package ===
157 [ "$install" == "yes" ] &&
158 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
160 # === Cleanup ===
161 # Preserve package file, if requested
162 [ "$keep" == "yes" ] &&
163 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR;
164 echo $PACKAGE-$VERSION.tazpkg saved to $CUR_DIR )
166 # Remove temporary build directory
167 cd $CUR_DIR
168 rm -rf $TMP_DIR