wok view get-vivaldi/stuff/get-vivaldi @ rev 25037

Up glza (0.11.4)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 21 21:38:29 2022 +0000 (23 months ago)
parents e5a22a781f60
children
line source
1 #!/bin/sh
2 #
3 # get-vivaldi - create and install SliTaz package vivaldi
4 #
5 # (C) 2021 SliTaz - GNU General Public License v3.
6 # Author : Aleksej Bobylev
7 # modified by Hans-Günter Theisgen on 2021-04-13
8 #
10 # === Initialisations ===
12 PKGS_DB="/var/lib/tazpkg" # packages database directory
13 PACKAGE="vivaldi"
14 CATEGORY="non-free"
15 SHORT=DESC="An advanced browser made with the power user in mind."
16 MAINTAINER="nobody@slitaz.org"
17 LICENSE="non-free"
18 WEB_SITE="https://vivaldi.com/"
19 # at least valid for 3.7.2218.52-1:
20 DEPENDS="at-spi2-atk bash GConf gtk+3 libcups libexif libxkbcommon mesa-wayland nss xorg-libxshmfence"
22 # Declare functions check_root, status, ...
23 . /lib/libtaz.sh
24 # and make commandline options (if any) available as variables
26 is_installed()
27 {
28 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
29 then #package is deemed to be installed
30 return 0
31 else
32 return 1
33 fi
34 }
36 # Show commandline options, if requested by --help
37 if [ "$help" == "yes" ]
38 then
39 echo "Commandline options:
40 $0
41 --version=<version>
42 --root=<path-to-root>
43 --install=yes|no
44 --keep=no|yes
45 --tmpdir=<directory-to-build-package>
46 --logfile=<logging-file>"
47 exit
48 fi
50 # Check for system administrator privileges
51 check_root
53 title "Package $PACKAGE will be build as SliTaz package and installed"
55 # Fetch latest version, unless version is set by option --version
56 # For available versions look at https://vivaldi.com/download/archive/
57 [ -z "$version" ] && version="latest"
59 # Install SliTaz package, unless inhibited by option --install=no
60 [ -z "$install" ] && install="yes"
62 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
63 # unless option --keep=yes is given
64 [ -z "$keep" ] && keep="no"
66 # Directory for temporary files
67 TMP_DIR="$tmpdir"
68 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
70 # Logging file (unused by now)
71 LOG="$logfile"
72 [ -z "$logfile" ] && LOG=$TMP_DIR/get-$PACKAGE.log
74 cat <<EOT
75 Options in use:
76 root : $root/
77 version : $version
78 install package: $install
79 keep tazpkg : $keep
80 build directory: $TMP_DIR
81 logging file : $LOG
83 EOT
85 separator; newline
87 # === Remove package, if installed ===
88 if is_installed
89 then
90 echo "$PACKAGE is already installed."
91 echo -n "Would you like to remove and reinstall this package [y/n]? "
92 read answer
93 case "$answer" in
94 y|Y)
95 action "Removing installed version..."
96 tazpkg remove $PACKAGE --root="$root/"
97 [ ! is_installed ] &&
98 die "Can't remove installed version. Exiting."
99 ;;
100 *)
101 echo "Leaving $PACKAGE untouched."
102 exit 0
103 ;;
104 esac
105 fi
107 # === Fetch rpm package, if not existing ===
108 if [ "$version" == "latest" ]
109 then
110 dl_page='https://vivaldi.com/download'
111 dl_type='i386.rpm'
112 WGET_URL=$(busybox wget -O - "$dl_page" | sed "/$dl_type/!d;s|.*href=\"\\([^\"]*\\)\.i386\.rpm.*|\\1|")
113 VERSION=${WGET_URL#*vivaldi-stable-*}
114 WGET_URL=$WGET_URL.$dl_type
115 FILE=$(basename $WGET_URL)
116 else
117 VERSION=$version
118 FILE="${PACKAGE}-stable-${VERSION}.i386.rpm"
119 WGET_URL="https://downloads.vivaldi.com/stable/$FILE"
120 fi
122 CUR_DIR=$(pwd)
123 mkdir -p $TMP_DIR
124 cd $TMP_DIR
125 if [ -f $FILE ]
126 then
127 echo "Using existing archive file $FILE"
128 else
129 action "Fetching the archive"
130 newline
131 wget --no-check-certificate $WGET_URL
132 if [ ! -f $FILE ]
133 then
134 cd $CUR_DIR
135 rm -rf $TMP_DIR
136 echo "Could not transfer $FILE from $WGET_URL. Exiting."
137 exit 1
138 fi
139 fi
141 action "Extracting the rpm package"
142 newline
143 rpm2cpio $FILE | cpio -dium
144 status
146 # Remove archive file
147 rm -f $FILE
149 # === Create SliTaz package ===
150 # Remove updater cron job
151 rm -r ./etc
153 # Add icons
154 for size in 16 22 24 32 48 64 128 256
155 do
156 mkdir -p "$TMP_DIR/usr/share/icons/hicolor/${size}x$size/apps"
157 ln -s /opt/vivaldi/product_logo_$size.png \
158 "$TMP_DIR/usr/share/icons/hicolor/${size}x$size/apps/vivaldi.png"
159 done
161 # Prepare to packaging
162 mkdir -p $TMP_DIR/$PACKAGE-$VERSION/fs
163 mv $TMP_DIR/opt $TMP_DIR/$PACKAGE-$VERSION/fs
164 mv $TMP_DIR/usr $TMP_DIR/$PACKAGE-$VERSION/fs
166 cat > $TMP_DIR/$PACKAGE-$VERSION/receipt << EOT
167 PACKAGE="$PACKAGE"
168 VERSION="$VERSION"
169 CATEGORY="$CATEGORY"
170 SHORT_DESC="$SHORT_DESC"
171 DEPENDS="$DEPENDS"
172 WEB_SITE="$WEB_SITE"
173 EOT
175 tazpkg pack $PACKAGE-$VERSION gzip
177 # === Install the SliTaz package ===
178 [ "$install" == "yes" ] &&
179 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
181 # === Cleanup ===
182 # Preserve package file, if requested
183 [ "$keep" == "yes" ] &&
184 ( mv $PACKAGE-$VERSION.tazpkg $CUR_DIR &&
185 echo "Saved $PACKAGE-$VERSION.tazpkg to $CUR_DIR" )
187 # Remove temporary build directory
188 cd $CUR_DIR
189 rm -rf $TMP_DIR