-
Notifications
You must be signed in to change notification settings - Fork 4
/
rockcraft.yaml
93 lines (92 loc) · 3.36 KB
/
rockcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: charmed-mysql
base: [email protected]
version: '8.0.39'
summary: Charmed MySQL ROCK OCI
description: |
MySQL built from the official MySQL package
from the MySQL repository and installs
mysql-shell. For more information on ROCKs, visit
the https://github.com/canonical/rockcraft.
license: Apache-2.0
platforms:
amd64:
arm64:
parts:
charmed-mysql:
plugin: nil
overlay-packages:
- util-linux
- logrotate
- libssh-4
- libbrotli1
- libicu70
- libevent-core-2.1-7
- libevent-pthreads-2.1-7
- libprotobuf-lite23
- libexpat1
- python3
- ca-certificates
- libedit2
# mysqlsh dependencies
- python3-certifi
- python3-yaml
stage-snaps:
- charmed-mysql/8.0/edge
override-prime: |
craftctl default
mv -f $CRAFT_PRIME/etc/mysql/mysql.cnf $CRAFT_PRIME/etc/mysql/my.cnf
mkdir -p $CRAFT_PRIME/var/log/mysql
chown -R 584788:584788 $CRAFT_PRIME/var/log/mysql
organize:
usr/share/doc/logrotate/copyright: licenses/COPYRIGHT-logrotate
non-root-user:
plugin: nil
after:
- charmed-mysql
overlay-script: |
# Create a user in the $CRAFT_OVERLAY chroot
groupadd -R $CRAFT_OVERLAY -g 584788 mysql
useradd -R $CRAFT_OVERLAY --create-home -r -g mysql -u 584788 mysql
override-prime: |
craftctl default
array=( .bash_logout .bashrc .profile )
for i in "${array[@]}"
do
cp /etc/skel/"$i" $CRAFT_PRIME/home/mysql
done
mkdir -p $CRAFT_PRIME/var/lib/mysql-files
mkdir -p $CRAFT_PRIME/var/run/mysqld
mkdir -p $CRAFT_PRIME/etc/mysqlrouter
mkdir -p $CRAFT_PRIME/var/lib/mysqlrouter
mkdir -p $CRAFT_PRIME/var/log/mysqlrouter
chown -R 584788 $CRAFT_PRIME/var/lib/mysql*
chown -R 584788 $CRAFT_PRIME/var/run/mysqld
chown -R 584788 $CRAFT_PRIME/etc/mysql
chown -R 584788:584788 $CRAFT_PRIME/etc/mysqlrouter
chown -R 584788:584788 $CRAFT_PRIME/var/lib/mysqlrouter
chown -R 584788:584788 $CRAFT_PRIME/var/log/mysqlrouter
# Generate dpkg.query
mkdir -p $CRAFT_PRIME/usr/share/rocks
echo "# os-release" > $CRAFT_PRIME/usr/share/rocks/dpkg.query
cat \
${CRAFT_PROJECT_DIR}/../bundles/ubuntu-22.04/rootfs/etc/os-release \
>> $CRAFT_PRIME/usr/share/rocks/dpkg.query
echo "# dpkg-query" >> $CRAFT_PRIME/usr/share/rocks/dpkg.query
declare -a fields
fields+=('${db:Status-Abbrev}')
fields+=('${binary:Package}')
fields+=('${Version}')
fields+=('${source:Package}')
fields+=('${Source:Version}')
printf -v dpkg_ops '%s,' "${fields[@]}"
dpkg-query -W -f "${dpkg_ops}\n" \
--root=${CRAFT_PROJECT_DIR}/../parts/charmed-mysql/layer/ \
>> $CRAFT_PRIME/usr/share/rocks/dpkg.query
rock-license:
plugin: dump
source: .
source-type: local
stage:
- licenses/LICENSE-rock
organize:
LICENSE: licenses/LICENSE-rock