wok-6.x view get-uae/stuff/get-uae @ rev 23342
updated perl-http-cookies (6.01 -> 6.08)
author | Hans-G?nter Theisgen |
---|---|
date | Tue Mar 31 09:07:34 2020 +0100 (2020-03-31) |
parents | 8649e33c279c |
children |
line source
1 #!/bin/sh
2 #
3 # get-uae - create and install SliTaz package uae
4 #
5 # (C) 2019 SliTaz - GNU General Public License v3.
6 # Author : HGT
7 # created: 2019-10-24
8 #
10 # === Initialisations ===
12 PKGS_DB="/var/lib/tazpkg" # packages database directory
13 PACKAGE="uae" # package to create and install
14 WEB_SITE="http://www.amigaemulator.org/"
15 CATEGORY="system-tools"
16 TAGS="emulator"
18 # Declare functions check_root, status, ...
19 . /lib/libtaz.sh
20 # and make commandline options (if any) available as variables
22 is_installed()
23 {
24 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
25 then #package is deemed to be installed
26 return 0
27 else
28 return 1
29 fi
30 }
33 # Show commandline options, if requested by --help
34 if [ "$help" == "yes" ]
35 then
36 echo "Commandline options:
37 $0
38 --version=<version>
39 --root=<path-to-root>
40 --install=yes|no
41 --keep=no|yes
42 --tmpdir=<directory-to-build-package>"
43 exit
44 fi
46 # Check for system administrator privileges
47 check_root
49 title "Package $PACKAGE will be build as SliTaz package and installed"
51 # Fetch latest version, unless version is set by option --version
52 [ -z "$version" ] && version="latest"
54 # Install SliTaz package, unless inhibited by option --install=no
55 [ -z "$install" ] && install="yes"
57 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
58 # unless option --keep=yes is given
59 [ -z "$keep" ] && keep="no"
61 # Directory for temporary files
62 [ -z "$tempdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
64 # Logging file (unused by now)
65 LOG=$TMP_DIR/get-$PACKAGE.log
67 cat <<EOT
68 Options in use:
69 root : $root/
70 version : $version
71 install package: $install
72 keep tazpkg : $keep
73 build directory: $TMP_DIR
75 EOT
77 separator; newline
79 # === Remove package, if installed ===
80 if [ is_installed ]
81 then
82 action "Removing installed version..."
83 tazpkg remove $PACKAGE --root="$root/"
84 [ ! is_installed ] &&
85 die "Can't remove installed version. Exiting."
86 fi
88 # === Fetch archive file, if not existing ===
90 WGET_URL="https://snapshot.debian.org/archive/debian/20100301T043504Z/pool/contrib/u/uae/"
91 if [ "$version" == "latest" ]
92 then
93 # wget --output-document=index $URL
94 # output to be scanned for latest version!
95 VERSION="0.8.29-7"
96 else
97 VERSION=$version
98 fi
100 FILE="${PACKAGE}_${VERSION}_i386.deb"
101 WGET_URL="https://snapshot.debian.org/archive/debian/20100301T043504Z/pool/contrib/u/$PACKAGE/$FILE"
103 CUR_DIR=$(pwd)
104 mkdir -p $TMP_DIR
105 cd $TMP_DIR
106 if [ -f $FILE ]
107 then
108 echo "Using existing archive file $FILE"
109 else
110 action "Fetching the archive"
111 newline
112 wget --no-check-certificate $WGET_URL
113 if [ ! -f $FILE ]
114 then
115 cd $CUR_DIR
116 rm -rf $TMP_DIR
117 echo "Could not transfer $FILE from $WGET_URL. Exiting."
118 exit 1
119 fi
120 fi
122 action "Creating the package $PACKAGE..."
123 # Convert from Debian format
124 tazpkg convert $FILE
126 # === Install the SliTaz package ===
127 [ "$install" == "yes" ] &&
128 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
130 # === Cleanup ===
131 # Preserve package file, if requested
132 [ "$keep" == "yes" ] && mv $PACKAGE-$VERSION.tazpkg $CUR_DIR
134 # Remove temporary build directory
135 cd $CUR_DIR
136 rm -rf $TMP_DIR