|
| 1 | +#!/bin/sh -e |
| 2 | +# Super crude and simple for now, just to show the basic ideas of |
| 3 | +# how I actually built RPM builds of AOSC OS - and from what I can |
| 4 | +# see so far, this method works just fine. |
| 5 | +##@author 2015 Mingcong Bai (JeffBai) <[email protected]>. |
| 6 | +##@author 2015 Mingye Wang (Arthur2e5) <[email protected]>. |
| 7 | +##@author 2013 Mikko Rantalainen <[email protected]>. (error handler) |
| 8 | +##@copyright MIT-1.0 |
| 9 | + |
| 10 | +##Error handler by Mikko Rantalainen. |
| 11 | +on_error() { |
| 12 | + local parent_lineno="$1" |
| 13 | + local message="$3" |
| 14 | + local code="$2" |
| 15 | + if [[ -n "$message" ]] ; then |
| 16 | + echo "Error on or near line ${parent_lineno}: ${message}; Code ${code}" |
| 17 | + else |
| 18 | + echo "Error on or near line ${parent_lineno}; Code ${code}" |
| 19 | + fi >&2 |
| 20 | + echo "This error is triggered by \`sh -e' in the script; to override it, run `sh "$0"` instead." |
| 21 | + exit $code |
| 22 | +} |
| 23 | +trap 'on_error ${LINENO} $?' ERR |
| 24 | + |
| 25 | +REPO=https://repo.anthonos.org |
| 26 | +# Get needed tools for RPM conversion |
| 27 | +apt update |
| 28 | +apt install zypper --yes |
| 29 | + |
| 30 | +# Remove PackageKit as it is not supported on RPM for now |
| 31 | +apt purge packagekit gnome-packagekit apper muon-explorer --yes |
| 32 | + |
| 33 | +# Get the list of DPKG packages with "Installed" state, specifically: |
| 34 | +# Includes Zypper at this point, of course... |
| 35 | +dpkg -l | grep ^ii | cut -d' ' -f 2 > /run/aosc-dpkg-list |
| 36 | + |
| 37 | +# Configure Zypper repositories |
| 38 | +zypper ar "$REPO/os3-next/os3-rpm" "AOSC OS3" |
| 39 | + |
| 40 | +# Install RPM packages |
| 41 | +zypper refresh |
| 42 | +zypper install $(cat /run/aosc-dpkg-list) |
| 43 | + |
| 44 | +# Now purge DPKG and Apt from the system |
| 45 | +apt purge apt dpkg --force-yes # Does this skip "Yes, do as I say!"? |
| 46 | + |
| 47 | +# And clean up... |
| 48 | +rm -rf /var/cache/apt |
| 49 | +rm -rf /var/lib/{dpkg,apt,PackageKit} |
| 50 | + |
| 51 | +# Boom, and done |
| 52 | +echo "Conversion complete!" |
0 commit comments