forked from canonical/ubuntu-desktop-provision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapcraft.yaml
137 lines (127 loc) · 3.57 KB
/
snapcraft.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: factory-reset-tools
version: '1.0'
summary: Factory Reset Tools
description: |
A tool to create reset media and reboot into the factory reset menu, for Ubuntu-preinstalled systems.
base: core22
confinement: strict
grade: stable
# for now, only build for amd64, since PC OEM does not have other architectures at the moment...
architectures:
- build-on: [amd64]
apps:
factory-reset-tools:
command: bin/factory-reset-tools
extensions: [gnome]
plugs:
- shutdown
- removable-media
- block-devices
- etc-reset-partition-fsuuid
- usr-share-desktop-provision-reset-yaml
- udisks2
- hardware-observe
- mount-observe
- dbus-client
cli:
command: bin/factory-reset-tools-cli
plugs:
- shutdown
- removable-media
- block-devices
- etc-reset-partition-fsuuid
- usr-share-desktop-provision-reset-yaml
- udisks2
- hardware-observe
- mount-observe
- dbus-client
dbus-daemon:
command: bin/factory-reset-tools-cli dbus
daemon: simple
activates-on: [dbus-service]
plugs:
- shutdown
- hostfs-boot-grub
- usr-share-desktop-provision-reset-yaml
parts:
flutter-git:
plugin: nil
source: .
override-pull: |
# necessary when reruns using the same container
if [ -d "flutter" ]; then
rm -rf "flutter"
fi
craftctl default
FLUTTER_VERSION=$(sed -n "s/^flutter \([0-9.]\+\).*/\1/p" .tool-versions)
git clone -b $FLUTTER_VERSION --depth 1 https://github.com/flutter/flutter.git
override-build: |
mkdir -p $CRAFT_PART_INSTALL/usr/bin
mkdir -p $CRAFT_PART_INSTALL/usr/libexec
cp -r $CRAFT_PART_SRC/flutter $CRAFT_PART_INSTALL/usr/libexec/flutter
ln -s $CRAFT_PART_INSTALL/usr/libexec/flutter/bin/flutter $CRAFT_PART_INSTALL/usr/bin/flutter
ln -s $CRAFT_PART_INSTALL/usr/libexec/flutter/bin/dart $CRAFT_PART_INSTALL/usr/bin/dart
$CRAFT_PART_INSTALL/usr/bin/flutter doctor
build-packages:
- clang
- cmake
- curl
- libgtk-3-dev
- ninja-build
- unzip
- xz-utils
- zip
override-prime: ""
factory-reset-tools:
after: [flutter-git]
plugin: nil
source: .
source-type: git
build-attributes: [enable-patchelf]
override-build: |
set -eux
mkdir -p $CRAFT_PART_INSTALL/bin
dart pub global activate melos
dart pub global run melos bootstrap
cd packages/factory_reset_tools
flutter build linux --release -v
cp -r build/linux/*/release/bundle/* $CRAFT_PART_INSTALL/bin/
factory-reset-tools-cli:
after: [flutter-git]
source: .
plugin: nil
override-build: |
set -eux
mkdir -p $CRAFT_PART_INSTALL/bin
dart pub global activate melos
dart pub global run melos bootstrap
cd packages/factory_reset_tools
dart compile exe -o factory-reset-tools-cli lib/dbus/cmdline.dart
cp factory-reset-tools-cli $CRAFT_PART_INSTALL/bin/
stage-packages:
- rsync
- grub2-common
build-packages:
- curl
slots:
dbus-service:
interface: dbus
bus: system
name: com.canonical.oem.FactoryResetTools
plugs:
hostfs-boot-grub:
interface: system-files
write:
- /var/lib/snapd/hostfs/boot/grub
etc-reset-partition-fsuuid:
interface: system-files
read:
- /etc/reset_partition_fsuuid
usr-share-desktop-provision-reset-yaml:
interface: system-files
read:
- /usr/share/desktop-provision/reset.yaml
dbus-client:
interface: dbus
bus: system
name: com.canonical.oem.FactoryResetTools