diff --git a/.gitignore b/.gitignore index f8e0cfed2259432a1006953012d507a4f9872f3e..f634dd2e0c3058a42fb426358e0469ddc6c8942e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ !.travis cachegrind.* perf.* +git_revision.txt target manual/book .cargo/config diff --git a/Makefile b/Makefile index 1f75662b102388221f42b7d6b08d1b3637f57d47..204e2a77ff9e99e74a677f1c8bc9c07ca7fcab01 100644 --- a/Makefile +++ b/Makefile @@ -3,31 +3,32 @@ BINARY = $(prefix)/bin/ion RELEASE = debug DEBUG ?= 0 VENDORED = 0 +REDOX ?= 0 ifeq (0,$(DEBUG)) ARGS += --release RELEASE = release endif -ifeq (1,$(REDOX)) - ARGS += --target x86_64-unknown-redox -endif - ifneq ($(wildcard vendor.tar.xz),) - VENDORED = 1 ARGSV += --frozen endif +ifeq (1,$(REDOX)) + undefine ARGSV + ARGS += --target x86_64-unknown-redox +endif + .PHONY: all clean distclean install uninstall -all: extract .cargo/config +all: version extract .cargo/config cargo build $(ARGS) $(ARGSV) clean: cargo clean -distclean: - rm -rf vendor vendor.tar.xz .cargo +distclean: clean + rm -rf vendor vendor.tar.xz .cargo git_revision.txt tests: cargo test $(ARGSV) @@ -44,23 +45,31 @@ uninstall: .cargo/config: mkdir -p .cargo - if [ -f vendor.tar.xz ]; then \ + echo $(wildcard vendor.tar.xz) + if [ "$(wildcard vendor.tar.xz)" != "" ]; then \ cp vendor_config $@; \ else \ cp nonvendor_config $@; \ - fi \ + fi vendor.tar.xz: cargo vendor tar pcfJ vendor.tar.xz vendor rm -rf vendor -vendor: .cargo/config vendor.tar.xz +vendor: vendor.tar.xz .cargo/config extract: -ifeq (1,$(VENDORED)$(wildcard vendor)) +ifneq ($(wildcard vendor.tar.xz),) +ifneq (1,$(REDOX)) tar pxf vendor.tar.xz endif +endif + +version: +ifeq ($(wildcard git_revision.txt),) + git rev-parse master > git_revision.txt +endif update-shells: if ! grep ion /etc/shells >/dev/null; then \ @@ -71,3 +80,4 @@ update-shells: sed -i -e "s#$$shell#$(BINARY)#g" /etc/shells; \ fi \ fi + diff --git a/README.md b/README.md index 1fac83b764599e1f7d5ba0f0b24dbf9f7ca153f8..997e0f16124749c40927cabccdfbf0e5518631cf 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,16 @@ The manual is located [here](https://doc.redox-os.org/ion-manual/) on Redox OS's also included in the source code for Ion, within the **manual** directory, which you may build with **mdbook**. +# Packages + +## Pop!\_OS / Ubuntu + +The following PPA supports the 18.04 (bionic) and 18.10 (cosmic) releases. Bionic builds were made using the Pop\_OS PPA's rustc 1.28.0 package. + +``` +sudo add-apt-repository ppa:mmstick76/ion-shell +``` + # Build dependencies Those who are developing software with Rust should install the [Rustup toolchain manager](https://rustup.rs/). diff --git a/build.rs b/build.rs index 34086f58fc710eef4ef62ff0e1eacf7cfe26d0ce..bca47492676f4dbe459962ad82173e762b12096b 100644 --- a/build.rs +++ b/build.rs @@ -5,7 +5,7 @@ use std::{ env, - fs::File, + fs::{self, File}, io::{self, Read, Write}, path::Path, process::Command, @@ -34,14 +34,19 @@ fn write_version_file() -> io::Result<()> { } fn get_git_rev() -> io::Result<String> { - let rev = match Command::new("git").arg("rev-parse").arg("master").output() { - Ok(out) => match String::from_utf8(out.stdout) { - Ok(s) => s, - Err(_) => git_rev_from_file()?, - }, - Err(_) => git_rev_from_file()?, - }; - Ok(rev) + let version_file = Path::new("git_revision.txt"); + if version_file.exists() { + fs::read_to_string(&version_file) + } else { + Command::new("git").arg("rev-parse").arg("master").output() + .and_then(|out| { + String::from_utf8(out.stdout).map_err(|_| io::Error::new( + io::ErrorKind::InvalidData, + format!("git rev-parse master output was not UTF-8") + )) + }) + .or_else(|_| git_rev_from_file()) + } } fn git_rev_from_file() -> io::Result<String> { diff --git a/debian/changelog b/debian/changelog index cb471a7f3b70e0761e5e8a126d9278615b3a78d6..65f8a017e046c464c039b6dd06ccf80005bf7ef0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ -ion-shell (1.0.0~alpha0) cosmic; urgency=medium +ion-shell (1.0.0-alpha0-cosmic2) cosmic; urgency=medium - * Initial release + * Add postinst script for setting the shell. + + -- Michael Aaron Murphy <michael@system76.com> Thu, 01 Nov 2018 16:44:15 -0600 - -- Michael Aaron Murphy <michael@system76.com> Sat, 20 Oct 2018 12:12:12 -0600 diff --git a/debian/files b/debian/files deleted file mode 100644 index 4a261d6ff1d2e8fcc028f14b14e79255c50b5a37..0000000000000000000000000000000000000000 --- a/debian/files +++ /dev/null @@ -1,3 +0,0 @@ -ion-shell-dbgsym_1.0.0~alpha0_amd64.ddeb debug optional -ion-shell_1.0.0~alpha0_amd64.buildinfo admin optional -ion-shell_1.0.0~alpha0_amd64.deb admin optional diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000000000000000000000000000000000000..a3f34d6075e09d487fe8f3a19a071573f23b7620 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,10 @@ +#!/bin/sh +BINARY="/usr/bin/ion" +if ! grep ion /etc/shells >/dev/null; then + echo ${BINARY} >> /etc/shells +else + shell=$(grep ion /etc/shells) + if [ "$shell" != "${BINARY}" ]; then + sed -i -e "s#$shell#${BINARY}#g" /etc/shells + fi +fi diff --git a/debian/postinstall b/debian/postinstall deleted file mode 100644 index e2e6f7d2517baa94d7952f9c45d60e661b395685..0000000000000000000000000000000000000000 --- a/debian/postinstall +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -if ! grep ion /etc/shells >/dev/null; then - echo $(BINARY) >> /etc/shells; -else - shell=$(shell grep ion /etc/shells); - if [ $$shell != $(BINARY) ]; then - before=$$(echo $$shell | sed 's/\//\\\//g'); - after=$$(echo $(BINARY) | sed 's/\//\\\//g'); - sed -i -e "s/$$before/$$after/g" /etc/shells; - fi -fi - diff --git a/debian/rules b/debian/rules index fd1330ac3715b2599b3fefa3aeb1a583a21c3156..3e19f9f1ee3fd9568d5c8b2339f8d54d108cbb3b 100755 --- a/debian/rules +++ b/debian/rules @@ -4,8 +4,14 @@ dh $@ override_dh_auto_clean: + cat git_revision.txt || echo git_revision.txt not found make clean make vendor + make version + +override_dh_auto_build: + cat .cargo/config + make all override_dh_auto_install: dh_auto_install -- prefix=/usr