Skip to content

Commit

Permalink
Ensure cache files exist before trying to write to them
Browse files Browse the repository at this point in the history
Also remove Justfile in favor of PKGBUILD and postinst scripts
  • Loading branch information
hwittenborn committed Sep 25, 2022
1 parent b742732 commit 1cba924
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 41 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.9.2] - 2022-09-25
### Fixed
- Add `postinst` script to set permissions on executable in installed package.
- Ensure MPR cache files exist before trying to write to them.

## [0.9.1] - 2022-09-25
### Fixed
- Allow passing the `NO_SUDO` environment variable to builds.
Expand Down
2 changes: 1 addition & 1 deletion 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.1"
version = "0.9.2"
authors = ["Hunter Wittenborn <[email protected]"]
description = "The official command-line interface for the makedeb Package Repository"
edition = "2021"
Expand Down
36 changes: 0 additions & 36 deletions justfile

This file was deleted.

10 changes: 7 additions & 3 deletions makedeb/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Maintainer: Hunter Wittenborn <[email protected]>

# NOTE: If you're installing this from the MPR you'll need to pass
# `-H 'MPR-Package: yes'` to your `makedeb` call if you want Mist to be able to
# automatically update itself.
pkgname=mist
pkgver=0.9.1
pkgver=0.9.2
pkgrel=1
pkgdesc='The official command-line interface for the makedeb Package Repository'
arch=('any')
Expand All @@ -14,19 +18,19 @@ optdepends=(
)
makedepends=(
'asciidoctor'
'just'
'rustup'
'pkg-config'
)
license=('GPL3')
url='https://github.com/makedeb/mist'
postinst='mist.postinst'

source=("${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('SKIP')

build() {
cd "${pkgname}-${pkgver}/"
just CARGO_RELEASE=1 NO_SUDO=1 build
cargo build --release
sed -i "s|:mansource: Git|:mansource: ${pkgver}|" man/mist.1.adoc
}

Expand Down
3 changes: 3 additions & 0 deletions makedeb/mist.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
chown 'root:root' /usr/bin/mist
chmod a+s /usr/bin/mist
2 changes: 2 additions & 0 deletions src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub fn update(args: &clap::ArgMatches) {
Ok(resp) => {
let mut cache_dir = util::xdg::get_global_cache_dir();
cache_dir.push("pkglist.gz");
util::fs::create_file(&cache_dir.clone().into_os_string().into_string().unwrap());
fs::write(&cache_dir, resp.bytes().unwrap()).unwrap();
}
Err(err) => {
Expand Down Expand Up @@ -229,5 +230,6 @@ pub fn update(args: &clap::ArgMatches) {
// Write the archive file.
cache_dir.pop();
cache_dir.push("cache.gz");
util::fs::create_file(&cache_dir.clone().into_os_string().into_string().unwrap());
fs::write(&cache_dir, resp).unwrap();
}

0 comments on commit 1cba924

Please sign in to comment.