-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaosc-os-dpkg2rpm
executable file
·52 lines (43 loc) · 1.64 KB
/
aosc-os-dpkg2rpm
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
#!/bin/sh -e
# Super crude and simple for now, just to show the basic ideas of
# how I actually built RPM builds of AOSC OS - and from what I can
# see so far, this method works just fine.
##@author 2015 Mingcong Bai (JeffBai) <[email protected]>.
##@author 2015 Mingye Wang (Arthur2e5) <[email protected]>.
##@author 2013 Mikko Rantalainen <[email protected]>. (error handler)
##@copyright MIT-1.0
##Error handler by Mikko Rantalainen.
on_error() {
local parent_lineno="$1"
local message="$3"
local code="$2"
if [[ -n "$message" ]] ; then
echo "Error on or near line ${parent_lineno}: ${message}; Code ${code}"
else
echo "Error on or near line ${parent_lineno}; Code ${code}"
fi >&2
echo "This error is triggered by \`sh -e' in the script; to override it, run `sh "$0"` instead."
exit $code
}
trap 'on_error ${LINENO} $?' ERR
REPO=https://repo.anthonos.org
# Get needed tools for RPM conversion
apt update
apt install zypper --yes
# Remove PackageKit as it is not supported on RPM for now
apt purge packagekit gnome-packagekit apper muon-explorer --yes
# Get the list of DPKG packages with "Installed" state, specifically:
# Includes Zypper at this point, of course...
dpkg -l | grep ^ii | cut -d' ' -f 2 > /run/aosc-dpkg-list
# Configure Zypper repositories
zypper ar "$REPO/os3-next/os3-rpm" "AOSC OS3"
# Install RPM packages
zypper refresh
zypper install $(cat /run/aosc-dpkg-list)
# Now purge DPKG and Apt from the system
apt purge apt dpkg --force-yes # Does this skip "Yes, do as I say!"?
# And clean up...
rm -rf /var/cache/apt
rm -rf /var/lib/{dpkg,apt,PackageKit}
# Boom, and done
echo "Conversion complete!"