Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d21141fefe | ||
|
|
0ec0e5a9dd | ||
|
|
9415d7c61f | ||
|
|
42188af02b | ||
|
|
e9581bcf15 | ||
|
|
6afe4f51c6 | ||
|
|
f623746d6c | ||
|
|
1ce4d66e74 | ||
|
|
3735d5c537 | ||
|
|
f3b1d2dfb3 | ||
|
|
7f7d2633cd | ||
|
|
afd95e3d5c | ||
|
|
8f72545894 | ||
|
|
d0d447deac | ||
|
|
53a8683788 | ||
|
|
81491a8d03 | ||
|
|
83504754ac | ||
|
|
2068c2c169 | ||
|
|
dbac121a90 |
2
.github/workflows/check-and-lint.yaml
vendored
2
.github/workflows/check-and-lint.yaml
vendored
@@ -7,7 +7,7 @@ on:
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUST_VER: '1.68.0'
|
RUST_VER: '1.71.0'
|
||||||
CROSS_VER: '0.2.5'
|
CROSS_VER: '0.2.5'
|
||||||
CARGO_NET_RETRY: 3
|
CARGO_NET_RETRY: 3
|
||||||
|
|
||||||
|
|||||||
@@ -57,10 +57,3 @@ jobs:
|
|||||||
# token: ${{ secrets.CODECOV_TOKEN }}
|
# token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
files: ./lcov.info
|
files: ./lcov.info
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
- name: Test creation of config file
|
|
||||||
run: |
|
|
||||||
CONFIG_PATH=~/.config/topgrade.toml;
|
|
||||||
if [ -f "$CONFIG_PATH" ]; then rm $CONFIG_PATH; fi
|
|
||||||
cargo build;
|
|
||||||
./target/debug/topgrade --dry-run --only system;
|
|
||||||
stat $CONFIG_PATH;
|
|
||||||
2
.github/workflows/crates-publish.yml
vendored
2
.github/workflows/crates-publish.yml
vendored
@@ -4,7 +4,7 @@ on:
|
|||||||
# types:
|
# types:
|
||||||
# - completed
|
# - completed
|
||||||
release:
|
release:
|
||||||
types: [published, edited]
|
types: [published]
|
||||||
|
|
||||||
name: Publish to crates.io on release
|
name: Publish to crates.io on release
|
||||||
|
|
||||||
|
|||||||
21
.github/workflows/test-config-creation.yml
vendored
Normal file
21
.github/workflows/test-config-creation.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: Test Configuration File Creation
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
TestConfig:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: |
|
||||||
|
CONFIG_PATH=~/.config/topgrade.toml;
|
||||||
|
if [ -f "$CONFIG_PATH" ]; then rm $CONFIG_PATH; fi
|
||||||
|
cargo build;
|
||||||
|
./target/debug/topgrade --dry-run --only system;
|
||||||
|
stat $CONFIG_PATH;
|
||||||
99
.github/workflows/update_pypi.yml
vendored
Normal file
99
.github/workflows/update_pypi.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
name: Update PyPi
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [x86_64, x86, aarch64]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
args: --release --out dist
|
||||||
|
sccache: 'true'
|
||||||
|
manylinux: auto
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [x64, x86]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
args: --release --out dist
|
||||||
|
sccache: 'true'
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [x86_64, aarch64]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build wheels
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
args: --release --out dist
|
||||||
|
sccache: 'true'
|
||||||
|
- name: Upload wheels
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
sdist:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build sdist
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
with:
|
||||||
|
command: sdist
|
||||||
|
args: --out dist
|
||||||
|
- name: Upload sdist
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "startsWith(github.ref, 'refs/tags/')"
|
||||||
|
needs: [linux, windows, macos, sdist]
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: wheels
|
||||||
|
- name: Publish to PyPI
|
||||||
|
uses: PyO3/maturin-action@v1
|
||||||
|
env:
|
||||||
|
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
with:
|
||||||
|
command: upload
|
||||||
|
args: --skip-existing *
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
## Contributing to `topgrade`
|
## Contributing to `topgrade`
|
||||||
|
|
||||||
Thank you for your interest in contributing to `topgrade`! We welcome and encourage
|
Thank you for your interest in contributing to `topgrade`!
|
||||||
contributions of all kinds, such as:
|
We welcome and encourage contributions of all kinds, such as:
|
||||||
|
|
||||||
1. Issue reports or feature requests
|
1. Issue reports or feature requests
|
||||||
2. Documentation improvements
|
2. Documentation improvements
|
||||||
3. Code (PR or PR Review)
|
3. Code (PR or PR Review)
|
||||||
|
|
||||||
|
Please follow the [Karma Runner guidelines](http://karma-runner.github.io/6.2/dev/git-commit-msg.html)
|
||||||
|
for commit messages.
|
||||||
|
|
||||||
## Adding a new `step`
|
## Adding a new `step`
|
||||||
|
|
||||||
In `topgrade`'s term, package manager is called `step`. To add a new `step` to
|
In `topgrade`'s term, package manager is called `step`.
|
||||||
`topgrade`:
|
To add a new `step` to `topgrade`:
|
||||||
|
|
||||||
1. Add a new variant to
|
1. Add a new variant to
|
||||||
[`enum Step`](https://github.com/topgrade-rs/topgrade/blob/cb7adc8ced8a77addf2cb051d18bba9f202ab866/src/config.rs#L100)
|
[`enum Step`](https://github.com/topgrade-rs/topgrade/blob/cb7adc8ced8a77addf2cb051d18bba9f202ab866/src/config.rs#L100)
|
||||||
|
|||||||
38
Cargo.lock
generated
38
Cargo.lock
generated
@@ -624,7 +624,7 @@ checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall 0.2.16",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1495,6 +1495,15 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_users"
|
name = "redox_users"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@@ -1502,7 +1511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"redox_syscall",
|
"redox_syscall 0.2.16",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1541,15 +1550,6 @@ version = "0.6.29"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "remove_dir_all"
|
|
||||||
version = "0.5.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.11.18"
|
version = "0.11.18"
|
||||||
@@ -1947,16 +1947,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.2.0"
|
version = "3.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"fastrand",
|
||||||
"rand",
|
"redox_syscall 0.3.5",
|
||||||
"redox_syscall",
|
"rustix",
|
||||||
"remove_dir_all",
|
"windows-sys 0.48.0",
|
||||||
"winapi",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2126,7 +2126,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "topgrade"
|
name = "topgrade"
|
||||||
version = "12.0.0"
|
version = "12.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ categories = ["os"]
|
|||||||
keywords = ["upgrade", "update"]
|
keywords = ["upgrade", "update"]
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
repository = "https://github.com/topgrade-rs/topgrade"
|
repository = "https://github.com/topgrade-rs/topgrade"
|
||||||
version = "12.0.0"
|
version = "12.0.1"
|
||||||
authors = ["Roey Darwish Dror <roey.ghost@gmail.com>", "Thomas Schönauer <t.schoenauer@hgs-wt.at>"]
|
authors = ["Roey Darwish Dror <roey.ghost@gmail.com>", "Thomas Schönauer <t.schoenauer@hgs-wt.at>"]
|
||||||
exclude = ["doc/screenshot.gif"]
|
exclude = ["doc/screenshot.gif"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
@@ -37,7 +37,7 @@ chrono = "~0.4"
|
|||||||
glob = "~0.3"
|
glob = "~0.3"
|
||||||
strum = { version = "~0.24", features = ["derive"] }
|
strum = { version = "~0.24", features = ["derive"] }
|
||||||
thiserror = "~1.0"
|
thiserror = "~1.0"
|
||||||
tempfile = "~3.2"
|
tempfile = "~3.6"
|
||||||
cfg-if = "~1.0"
|
cfg-if = "~1.0"
|
||||||
tokio = { version = "~1.18", features = ["process", "rt-multi-thread"] }
|
tokio = { version = "~1.18", features = ["process", "rt-multi-thread"] }
|
||||||
futures = "~0.3"
|
futures = "~0.3"
|
||||||
|
|||||||
@@ -34,11 +34,13 @@ To remedy this, **Topgrade** detects which tools you use and runs the appropriat
|
|||||||
- Void Linux: [XBPS](https://voidlinux.org/packages/?arch=x86_64&q=topgrade)
|
- Void Linux: [XBPS](https://voidlinux.org/packages/?arch=x86_64&q=topgrade)
|
||||||
- macOS: [Homebrew](https://formulae.brew.sh/formula/topgrade) or [MacPorts](https://ports.macports.org/port/topgrade/)
|
- macOS: [Homebrew](https://formulae.brew.sh/formula/topgrade) or [MacPorts](https://ports.macports.org/port/topgrade/)
|
||||||
- Windows: [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/topgrade.json)
|
- Windows: [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/topgrade.json)
|
||||||
|
- PyPi: [pip](https://pypi.org/project/topgrade/)
|
||||||
|
|
||||||
Other systems users can either use `cargo install` or the compiled binaries from the release page.
|
Other systems users can either use `cargo install` or the compiled binaries from the release page.
|
||||||
The compiled binaries contain a self-upgrading feature.
|
The compiled binaries contain a self-upgrading feature.
|
||||||
|
|
||||||
Topgrade requires Rust 1.60 or above.
|
> Currently, Topgrade requires Rust 1.65 or above. In general, Topgrade tracks
|
||||||
|
> the latest stable toolchain.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Include any additional configuration file(s)
|
# Include any additional configuration file(s)
|
||||||
# [include] sections are processed in the order you write them
|
# [include] sections are processed in the order you write them
|
||||||
# Files in $CONFIG_DIR/topgrade/topgrade.d/ are automatically included at the beginning of this file
|
# Files in $CONFIG_DIR/topgrade.d/ are automatically included before this file
|
||||||
[include]
|
[include]
|
||||||
#paths = ["/etc/topgrade.toml"]
|
#paths = ["/etc/topgrade.toml"]
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
# Sudo command to be used
|
# Sudo command to be used
|
||||||
#sudo_command = "sudo"
|
#sudo_command = "sudo"
|
||||||
|
|
||||||
# Run `sudo -v` to cache credentials at the start of the run; this avoids a
|
# Run `sudo -v` to cache credentials at the start of the run
|
||||||
# blocking password prompt in the middle of a possibly-unattended run.
|
# This avoids a blocking password prompt in the middle of an unattended run
|
||||||
#pre_sudo = false
|
#pre_sudo = false
|
||||||
|
|
||||||
# Run inside tmux
|
# Run inside tmux
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
# List of remote machines with Topgrade installed on them
|
# List of remote machines with Topgrade installed on them
|
||||||
#remote_topgrades = ["toothless", "pi", "parnas"]
|
#remote_topgrades = ["toothless", "pi", "parnas"]
|
||||||
|
|
||||||
# Arguments to pass SSH when upgrading remote systems
|
# Arguments to pass to SSH when upgrading remote systems
|
||||||
#ssh_arguments = "-o ConnectTimeout=2"
|
#ssh_arguments = "-o ConnectTimeout=2"
|
||||||
|
|
||||||
# Path to Topgrade executable on remote machines
|
# Path to Topgrade executable on remote machines
|
||||||
@@ -57,32 +57,28 @@
|
|||||||
# Whether to self update (this is ignored if the binary has been built without self update support, available also via setting the environment variable TOPGRADE_NO_SELF_UPGRADE)
|
# Whether to self update (this is ignored if the binary has been built without self update support, available also via setting the environment variable TOPGRADE_NO_SELF_UPGRADE)
|
||||||
#no_self_update = true
|
#no_self_update = true
|
||||||
|
|
||||||
[git]
|
|
||||||
#max_concurrency = 5
|
|
||||||
# Additional git repositories to pull
|
|
||||||
#repos = [
|
|
||||||
# "~/src/*/",
|
|
||||||
# "~/.config/something"
|
|
||||||
#]
|
|
||||||
|
|
||||||
# Don't pull the predefined git repos
|
|
||||||
#pull_predefined = false
|
|
||||||
|
|
||||||
# Arguments to pass Git when pulling Repositories
|
|
||||||
#arguments = "--rebase --autostash"
|
|
||||||
|
|
||||||
[composer]
|
|
||||||
#self_update = true
|
|
||||||
|
|
||||||
# Commands to run before anything
|
# Commands to run before anything
|
||||||
[pre_commands]
|
[pre_commands]
|
||||||
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
||||||
|
|
||||||
|
# Commands to run after anything
|
||||||
|
[post_commands]
|
||||||
|
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
|
||||||
|
|
||||||
# Custom commands
|
# Custom commands
|
||||||
[commands]
|
[commands]
|
||||||
#"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
|
#"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
|
||||||
#"Custom command using interactive shell (unix)" = "-i vim_upgrade"
|
#"Custom command using interactive shell (unix)" = "-i vim_upgrade"
|
||||||
|
|
||||||
|
[python]
|
||||||
|
#enable_pip_review = true ###disabled by default
|
||||||
|
#enable_pip_review_local = true ###disabled by default
|
||||||
|
#enable_pipupgrade = true ###disabled by default
|
||||||
|
#pipupgrade_arguments = "-y -u --pip-path pip" ###disabled by default
|
||||||
|
|
||||||
|
[composer]
|
||||||
|
#self_update = true
|
||||||
|
|
||||||
[brew]
|
[brew]
|
||||||
#greedy_cask = true
|
#greedy_cask = true
|
||||||
#autoremove = true
|
#autoremove = true
|
||||||
@@ -109,11 +105,19 @@
|
|||||||
#rpm_ostree = false
|
#rpm_ostree = false
|
||||||
#nix_arguments = "--flake"
|
#nix_arguments = "--flake"
|
||||||
|
|
||||||
[python]
|
[git]
|
||||||
#enable_pip_review = true ###disabled by default
|
#max_concurrency = 5
|
||||||
#enable_pip_review_local = true ###disabled by default
|
# Additional git repositories to pull
|
||||||
#enable_pipupgrade = true ###disabled by default
|
#repos = [
|
||||||
#pipupgrade_arguments = "-y -u --pip-path pip" ###disabled by default
|
# "~/src/*/",
|
||||||
|
# "~/.config/something"
|
||||||
|
#]
|
||||||
|
|
||||||
|
# Don't pull the predefined git repos
|
||||||
|
#pull_predefined = false
|
||||||
|
|
||||||
|
# Arguments to pass Git when pulling Repositories
|
||||||
|
#arguments = "--rebase --autostash"
|
||||||
|
|
||||||
[windows]
|
[windows]
|
||||||
# Manually select Windows updates
|
# Manually select Windows updates
|
||||||
@@ -131,10 +135,28 @@
|
|||||||
# Use sudo if the NPM directory isn't owned by the current user
|
# Use sudo if the NPM directory isn't owned by the current user
|
||||||
#use_sudo = true
|
#use_sudo = true
|
||||||
|
|
||||||
|
[yarn]
|
||||||
|
# Run `yarn global upgrade` with `sudo`
|
||||||
|
#use_sudo = true
|
||||||
|
|
||||||
|
[vim]
|
||||||
|
# For `vim-plug`, execute `PlugUpdate!` instead of `PlugUpdate`
|
||||||
|
#force_plug_update = true
|
||||||
|
|
||||||
[firmware]
|
[firmware]
|
||||||
# Offer to update firmware; if false just check for and display available updates
|
# Offer to update firmware; if false just check for and display available updates
|
||||||
#upgrade = true
|
#upgrade = true
|
||||||
|
|
||||||
|
[vagrant]
|
||||||
|
# Vagrant directories
|
||||||
|
#directories = []
|
||||||
|
|
||||||
|
# power on vagrant boxes if needed
|
||||||
|
#power_on = true
|
||||||
|
|
||||||
|
# Always suspend vagrant boxes instead of powering off
|
||||||
|
#always_suspend = true
|
||||||
|
|
||||||
[flatpak]
|
[flatpak]
|
||||||
# Use sudo for updating the system-wide installation
|
# Use sudo for updating the system-wide installation
|
||||||
#use_sudo = true
|
#use_sudo = true
|
||||||
|
|||||||
16
pyproject.toml
Normal file
16
pyproject.toml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["maturin>=1.0,<2.0"]
|
||||||
|
build-backend = "maturin"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "topgrade"
|
||||||
|
requires-python = ">=3.7"
|
||||||
|
classifiers = [
|
||||||
|
"Programming Language :: Rust",
|
||||||
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[tool.maturin]
|
||||||
|
bindings = "bin"
|
||||||
@@ -370,6 +370,8 @@ pub struct Vim {
|
|||||||
pub struct Misc {
|
pub struct Misc {
|
||||||
pre_sudo: Option<bool>,
|
pre_sudo: Option<bool>,
|
||||||
|
|
||||||
|
sudo_command: Option<SudoKind>,
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
|
||||||
git_repos: Option<Vec<String>>,
|
git_repos: Option<Vec<String>>,
|
||||||
|
|
||||||
@@ -440,8 +442,6 @@ pub struct ConfigFile {
|
|||||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
misc: Option<Misc>,
|
misc: Option<Misc>,
|
||||||
|
|
||||||
sudo_command: Option<SudoKind>,
|
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::commands_merge_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::commands_merge_opt)]
|
||||||
pre_commands: Option<Commands>,
|
pre_commands: Option<Commands>,
|
||||||
|
|
||||||
@@ -1389,7 +1389,7 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn sudo_command(&self) -> Option<SudoKind> {
|
pub fn sudo_command(&self) -> Option<SudoKind> {
|
||||||
self.config_file.sudo_command
|
self.config_file.misc.as_ref().and_then(|misc| misc.sudo_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If `true`, `sudo` should be called after `pre_commands` in order to elevate at the
|
/// If `true`, `sudo` should be called after `pre_commands` in order to elevate at the
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::sudo::Sudo;
|
|||||||
use crate::utils::{require_option, REQUIRE_SUDO};
|
use crate::utils::{require_option, REQUIRE_SUDO};
|
||||||
use crate::{config::Config, executor::Executor};
|
use crate::{config::Config, executor::Executor};
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
|
use std::env::var;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
@@ -17,16 +18,20 @@ pub struct ExecutionContext<'a> {
|
|||||||
/// This is used in `./steps/remote/ssh.rs`, where we want to run `topgrade` in a new
|
/// This is used in `./steps/remote/ssh.rs`, where we want to run `topgrade` in a new
|
||||||
/// tmux window for each remote.
|
/// tmux window for each remote.
|
||||||
tmux_session: Mutex<Option<String>>,
|
tmux_session: Mutex<Option<String>>,
|
||||||
|
/// True if topgrade is running under ssh.
|
||||||
|
under_ssh: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExecutionContext<'a> {
|
impl<'a> ExecutionContext<'a> {
|
||||||
pub fn new(run_type: RunType, sudo: Option<Sudo>, git: &'a Git, config: &'a Config) -> Self {
|
pub fn new(run_type: RunType, sudo: Option<Sudo>, git: &'a Git, config: &'a Config) -> Self {
|
||||||
|
let under_ssh = var("SSH_CLIENT").is_ok() || var("SSH_TTY").is_ok();
|
||||||
Self {
|
Self {
|
||||||
run_type,
|
run_type,
|
||||||
sudo,
|
sudo,
|
||||||
git,
|
git,
|
||||||
config,
|
config,
|
||||||
tmux_session: Mutex::new(None),
|
tmux_session: Mutex::new(None),
|
||||||
|
under_ssh,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +56,10 @@ impl<'a> ExecutionContext<'a> {
|
|||||||
self.config
|
self.config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn under_ssh(&self) -> bool {
|
||||||
|
self.under_ssh
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_tmux_session(&self, session_name: String) {
|
pub fn set_tmux_session(&self, session_name: String) {
|
||||||
self.tmux_session.lock().unwrap().replace(session_name);
|
self.tmux_session.lock().unwrap().replace(session_name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#[cfg(any(windows))]
|
#[cfg(windows)]
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
print_separator("Conda");
|
print_separator("Conda");
|
||||||
|
|
||||||
let mut command = ctx.run_type().execute(conda);
|
let mut command = ctx.run_type().execute(conda);
|
||||||
command.args(["update", "--all"]);
|
command.args(["update", "--all", "-n", "base"]);
|
||||||
if ctx.config().yes(Step::Conda) {
|
if ctx.config().yes(Step::Conda) {
|
||||||
command.arg("--yes");
|
command.arg("--yes");
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ pub fn run_mamba_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
print_separator("Mamba");
|
print_separator("Mamba");
|
||||||
|
|
||||||
let mut command = ctx.run_type().execute(mamba);
|
let mut command = ctx.run_type().execute(mamba);
|
||||||
command.args(["update", "--all"]);
|
command.args(["update", "--all", "-n", "base"]);
|
||||||
if ctx.config().yes(Step::Mamba) {
|
if ctx.config().yes(Step::Mamba) {
|
||||||
command.arg("--yes");
|
command.arg("--yes");
|
||||||
}
|
}
|
||||||
@@ -720,7 +720,8 @@ pub fn bin_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn spicetify_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
pub fn spicetify_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let spicetify = require("spicetify")?;
|
// As of 04-07-2023 NixOS packages Spicetify with the `spicetify-cli` binary name
|
||||||
|
let spicetify = require("spicetify").or(require("spicetify-cli"))?;
|
||||||
|
|
||||||
print_separator("Spicetify");
|
print_separator("Spicetify");
|
||||||
ctx.run_type().execute(spicetify).arg("upgrade").status_checked()
|
ctx.run_type().execute(spicetify).arg("upgrade").status_checked()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
print_separator("DragonFly BSD Packages");
|
print_separator("DragonFly BSD Packages");
|
||||||
ctx.execute(sudo)
|
ctx.execute(sudo)
|
||||||
.args(["/usr/local/sbin/pkg", "upgrade"])
|
.args(["/usr/local/sbin/pkg", "upgrade"])
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()
|
.status_checked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ fn upgrade_suse(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
} else {
|
} else {
|
||||||
"update"
|
"update"
|
||||||
})
|
})
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -272,6 +273,7 @@ fn upgrade_opensuse_tumbleweed(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.arg("zypper")
|
.arg("zypper")
|
||||||
.arg("dist-upgrade")
|
.arg("dist-upgrade")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -281,7 +283,9 @@ fn upgrade_suse_micro(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.args(["transactional-update", "dup"])
|
.arg("transactional-update")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-n" } else { "" })
|
||||||
|
.arg("dup")
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -325,6 +329,7 @@ fn upgrade_pclinuxos(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.arg(&which("apt-get").unwrap())
|
.arg(&which("apt-get").unwrap())
|
||||||
.arg("dist-upgrade")
|
.arg("dist-upgrade")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -499,7 +504,9 @@ fn upgrade_solus(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.args(["eopkg", "upgrade"])
|
.arg("eopkg")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
|
.arg("upgrade")
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -542,6 +549,11 @@ pub fn run_pacdef(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&pacdef)
|
.execute(&pacdef)
|
||||||
.args(["package", "sync"])
|
.args(["package", "sync"])
|
||||||
|
.arg(if ctx.config().yes(Step::System) {
|
||||||
|
"--noconfirm"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
})
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
@@ -550,7 +562,15 @@ pub fn run_pacdef(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
.args(["package", "review"])
|
.args(["package", "review"])
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
} else {
|
} else {
|
||||||
ctx.run_type().execute(&pacdef).arg("sync").status_checked()?;
|
ctx.run_type()
|
||||||
|
.execute(&pacdef)
|
||||||
|
.arg("sync")
|
||||||
|
.arg(if ctx.config().yes(Step::System) {
|
||||||
|
"--noconfirm"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
})
|
||||||
|
.status_checked()?;
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
ctx.run_type().execute(&pacdef).arg("review").status_checked()?;
|
ctx.run_type().execute(&pacdef).arg("review").status_checked()?;
|
||||||
@@ -599,6 +619,11 @@ fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.args(["swupd", "update"])
|
.args(["swupd", "update"])
|
||||||
|
.arg(if ctx.config().yes(Step::System) {
|
||||||
|
"--assume=yes"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
})
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -1014,4 +1039,9 @@ mod tests {
|
|||||||
fn test_vanilla() {
|
fn test_vanilla() {
|
||||||
test_template(include_str!("os_release/vanilla"), Distribution::Vanilla);
|
test_template(include_str!("os_release/vanilla"), Distribution::Vanilla);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_solus() {
|
||||||
|
test_template(include_str!("os_release/solus"), Distribution::Solus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/steps/os/os_release/solus
Normal file
11
src/steps/os/os_release/solus
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
NAME="Solus"
|
||||||
|
VERSION="4.4"
|
||||||
|
ID="solus"
|
||||||
|
VERSION_CODENAME=harmony
|
||||||
|
VERSION_ID="4.4"
|
||||||
|
PRETTY_NAME="Solus 4.4 Harmony"
|
||||||
|
ANSI_COLOR="1;34"
|
||||||
|
HOME_URL="https://getsol.us"
|
||||||
|
SUPPORT_URL="https://help.getsol.us/docs/user/contributing/getting-involved"
|
||||||
|
BUG_REPORT_URL="https://dev.getsol.us/"
|
||||||
|
LOGO="distributor-logo-solus"
|
||||||
@@ -155,7 +155,7 @@ pub fn run_oh_my_bash(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
print_separator("oh-my-bash");
|
print_separator("oh-my-bash");
|
||||||
|
|
||||||
let mut update_script = oh_my_bash;
|
let mut update_script = oh_my_bash;
|
||||||
update_script.push_str("tools/upgrade.sh");
|
update_script.push_str("/tools/upgrade.sh");
|
||||||
|
|
||||||
ctx.run_type().execute("bash").arg(update_script).status_checked()
|
ctx.run_type().execute("bash").arg(update_script).status_checked()
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
if let Ok(..) = require("darwin-rebuild") {
|
if require("darwin-rebuild").is_ok() {
|
||||||
return Err(SkipStep(String::from(
|
return Err(SkipStep(String::from(
|
||||||
"Nix-darwin on macOS must be upgraded via darwin-rebuild switch",
|
"Nix-darwin on macOS must be upgraded via darwin-rebuild switch",
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ pub fn run_toolbx(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
topgrade_path,
|
topgrade_path,
|
||||||
"--only",
|
"--only",
|
||||||
"system",
|
"system",
|
||||||
|
"--no-self-update",
|
||||||
|
"--skip-notify",
|
||||||
];
|
];
|
||||||
if ctx.config().yes(Step::Toolbx) {
|
if ctx.config().yes(Step::Toolbx) {
|
||||||
args.push("--yes");
|
args.push("--yes");
|
||||||
|
|||||||
@@ -165,6 +165,28 @@ pub fn run_zim(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
|
pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
|
||||||
require("zsh")?;
|
require("zsh")?;
|
||||||
|
|
||||||
|
// When updating `oh-my-zsh` on a remote machine through topgrade, the
|
||||||
|
// following processes will be created:
|
||||||
|
//
|
||||||
|
// SSH -> ZSH -> ZSH ($SHELL) -> topgrade -> ZSH
|
||||||
|
//
|
||||||
|
// The first ZSH process, won't source zshrc (as it is a login shell),
|
||||||
|
// and thus it won't have the ZSH environment variable, as a result, the
|
||||||
|
// children processes won't get it either, so we source the zshrc and set
|
||||||
|
// the ZSH variable for topgrade here.
|
||||||
|
if ctx.under_ssh() {
|
||||||
|
let zshrc_path = zshrc().require()?;
|
||||||
|
let output = Command::new("zsh")
|
||||||
|
.args([
|
||||||
|
"-c",
|
||||||
|
// ` > /dev/null` is used in case the user's zshrc will have some stdout output.
|
||||||
|
format!("source {} > /dev/null && echo $ZSH", zshrc_path.display()).as_str(),
|
||||||
|
])
|
||||||
|
.output_checked_utf8()?;
|
||||||
|
env::set_var("ZSH", output.stdout.trim());
|
||||||
|
}
|
||||||
|
|
||||||
let oh_my_zsh = env::var("ZSH")
|
let oh_my_zsh = env::var("ZSH")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
// default to `~/.oh-my-zsh`
|
// default to `~/.oh-my-zsh`
|
||||||
|
|||||||
Reference in New Issue
Block a user