-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate_systemd_services.sh
51 lines (43 loc) · 1.28 KB
/
migrate_systemd_services.sh
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
# Ignore these services, do not copy them over to the new root
arkdep_systemd_service_migrate_ignore=(
'NetworkManager-wait-online.service'
'NetworkManager.service'
'apparmor.service'
'arkane-flatpak-init.service'
'bluetooth.service'
'cups.path'
'cups.service'
'cups.socket'
'dbus-org.bluez.service'
'dbus-org.freedesktop.nm-dispatcher.service'
'display-manager.service'
'fstrim.timer'
'paccache.timer'
'remote-fs.target'
'switcheroo-control.service'
'systemd-boot-update.service'
'systemd-timesyncd.service'
'systemd-userdbd.socket'
)
printf '\e[1;32m-->\e[0m\e[1m Migrating systemd services to new deployment\e[0m\n'
# Get a list of all services
declare -r services=($(find /etc/systemd/system -type f,l))
for service in ${services[@]}; do
# Check if service is in ignore list
for ignore in ${arkdep_systemd_service_migrate_ignore[@]}; do
if [[ $service == *$ignore ]]; then
break_the_loop=1
continue
fi
done
# If service was determined to be on ignore list, skip it
if [[ $break_the_loop -eq 1 ]]; then
break_the_loop=0
continue
fi
# Ensure the parent directories exist
mkdir -pv $arkdep_dir/deployments/${data[0]}/rootfs/${service%/*}
# Copy service to new deployment
cp -v $service $arkdep_dir/deployments/${data[0]}/rootfs/$service
done