Skip to content

Commit

Permalink
Release '0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
hwittenborn committed Oct 1, 2022
1 parent d9f88b8 commit 9e70736
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0] - 2022-10-01
### Changed
- Don't allow running `install` or `upgrade` commands as root.

## [0.9.9] - 2022-09-26
### Changed
- Pass in each file manually to `${EDITOR}` during file review.
Expand Down
57 changes: 28 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mist"
version = "0.9.9"
version = "0.10.0"
authors = ["Hunter Wittenborn <hunter@hunterwittenborn.com"]
description = "The official command-line interface for the makedeb Package Repository"
edition = "2021"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ First, [set up the Prebuilt-MPR on your system](https://docs.makedeb.org/prebuil
sudo apt install mist
```

> You'll also need to have [makedeb installed](https://docs.makedeb.org/installing) if it is not already.
### From the MPR
You can also install Mist directly from the MPR if you'd prefer that.

Expand Down
3 changes: 2 additions & 1 deletion makedeb/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
# `-H 'MPR-Package: yes'` to your `makedeb` call if you want Mist to be able to
# automatically update itself.
pkgname=mist
pkgver=0.9.9
pkgver=0.10.0
pkgrel=1
pkgdesc='The official command-line interface for the makedeb Package Repository'
arch=('any')
depends=(
'libapt-pkg-dev'
'libssl-dev'
'makedeb|makedeb-beta|makedeb-alpha'
'sudo'
)
optdepends=(
Expand Down
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::{
fs::File,
os::{linux::fs::MetadataExt, unix::fs::PermissionsExt},
};
use style::Colorize;
use which::which;

#[rustfmt::skip]
Expand Down Expand Up @@ -241,6 +242,18 @@ fn main() {
// If we're running a command that should be permission-checked, then do so.
if vec!["install", "remove", "update", "upgrade"].contains(&cmd_results.subcommand().unwrap().0)
{
// If we're running a command that invokes 'makedeb', ensure that we're not
// running as root.
if vec!["install", "upgrade"].contains(&cmd_results.subcommand().unwrap().0)
&& *util::sudo::NORMAL_UID == 0
{
message::error(&format!(
"This command cannot be ran as root, as it needs to call '{}', which is required to run under a non-root user.\n",
"makedeb".bold().green()
));
quit::with_code(exitcode::USAGE);
}

util::sudo::check_perms();
}

Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ pub mod fs {
/// Sudo user management stuff.
pub mod sudo {
super::lazy_static! {
static ref NORMAL_UID: u32 = users::get_current_uid();
pub static ref NORMAL_UID: u32 = users::get_current_uid();
}

/// Change the user to root.
Expand Down

0 comments on commit 9e70736

Please sign in to comment.