mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-14 00:43:48 +01:00
fix: add package build and fix disko
This commit is contained in:
parent
f82656afbd
commit
2a59af78a8
3 changed files with 34 additions and 2 deletions
15
Makefile
Normal file
15
Makefile
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
SHARE ?= $(PREFIX)/share/disko
|
||||||
|
|
||||||
|
all:
|
||||||
|
|
||||||
|
SOURCES = disko cli.nix default.nix types.nix
|
||||||
|
|
||||||
|
install:
|
||||||
|
mkdir -p $(PREFIX)/bin $(SHARE)
|
||||||
|
sed \
|
||||||
|
-e "s|libexec_dir=\".*\"|libexec_dir=\"$(SHARE)\"|" \
|
||||||
|
-e "s|#!/usr/bin/env.*|#!/usr/bin/env bash|" \
|
||||||
|
disko > $(PREFIX)/bin/disko
|
||||||
|
chmod 755 $(PREFIX)/bin/disko
|
||||||
|
cp -r $(SOURCES) $(SHARE)
|
||||||
12
disko
12
disko
|
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
set -x
|
|
||||||
|
|
||||||
readonly libexec_dir="${0%/*}"
|
readonly libexec_dir="${0%/*}"
|
||||||
|
|
||||||
|
# a file with the disko config
|
||||||
|
declare disko_config
|
||||||
|
|
||||||
# mount was chosen as the default mode because it's less destructive
|
# mount was chosen as the default mode because it's less destructive
|
||||||
mode=mount
|
mode=mount
|
||||||
nix_args=()
|
nix_args=()
|
||||||
|
|
@ -30,6 +32,11 @@ abort() {
|
||||||
|
|
||||||
## Main ##
|
## Main ##
|
||||||
|
|
||||||
|
[[ $# -eq 0 ]] && {
|
||||||
|
showUsage
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-m | --mode)
|
-m | --mode)
|
||||||
|
|
@ -46,10 +53,11 @@ while [[ $# -gt 0 ]]; do
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -z ${disko_config+x} ] && [ -e $1 ]; then
|
if [ -z ${disko_config+x} ] && [ -e "$1" ]; then
|
||||||
disko_config=$1
|
disko_config=$1
|
||||||
else
|
else
|
||||||
showUsage
|
showUsage
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,15 @@
|
||||||
lib = import ./. {
|
lib = import ./. {
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
};
|
};
|
||||||
|
packages.x86_64-linux.disko = let
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
in pkgs.stdenv.mkDerivation {
|
||||||
|
name = "disko";
|
||||||
|
src = ./.;
|
||||||
|
meta.description = "Format disks with nix-config";
|
||||||
|
installFlags = [ "PREFIX=$(out)" ];
|
||||||
|
};
|
||||||
|
packages.x86_64-linux.default = self.packages.x86_64-linux.disko;
|
||||||
checks.x86_64-linux = let
|
checks.x86_64-linux = let
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue