live-sdk

simple distro kit (livecd edition)
git clone git://parazyd.org/live-sdk.git
Log | Files | Refs | Submodules | README | LICENSE

sdk (2709B)


      1 #!/usr/bin/env zsh
      2 # Copyright (c) 2016-2017 Dyne.org Foundation
      3 # live-sdk is written and maintained by Ivan J. <parazyd@dyne.org>
      4 #
      5 # This file is part of live-sdk
      6 #
      7 # This source code is free software: you can redistribute it and/or modify
      8 # it under the terms of the GNU General Public License as published by
      9 # the Free Software Foundation, either version 3 of the License, or
     10 # (at your option) any later version.
     11 #
     12 # This software is distributed in the hope that it will be useful,
     13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 # GNU General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with this source code. If not, see <http://www.gnu.org/licenses/>.
     19 
     20 livesdk_version="0.2"
     21 
     22 R=${LIVE_SDK-$PWD}
     23 
     24 DEBUG=1
     25 QUIET=0
     26 
     27 source $R/lib/zuper/zuper
     28 
     29 ## global vars
     30 vars+=(livesdk_version)
     31 vars+=(R workdir strapdir)
     32 vars+=(os oslib blendlib)
     33 vars+=(release)
     34 vars+=(MAKEOPTS)
     35 
     36 ## global arrs
     37 arrs+=(extra_packages)
     38 
     39 ## global maps
     40 maps+=(os_map blend_map)
     41 
     42 source $R/config
     43 #source $R/lib/helpers
     44 
     45 ## conclude zuper initialization
     46 source $R/lib/zuper/zuper.init
     47 
     48 load() {
     49 	fn load "$@"
     50 	os="$1"
     51 	arch="$2"
     52 	blend="$3"
     53 
     54 	[[ $# -gt 3 ]] && release="$4"
     55 
     56 	req=(os arch)
     57 	ckreq || return 1
     58 
     59 	case $arch in
     60 		amd64) earch="x86_64" ;;
     61 		i386)  earch="i686"   ;;
     62 		*) error "invalid arch specified"; zerr;;
     63 	esac
     64 
     65 	os_map=(
     66 		"devuan"    "$R/lib/libdevuansdk/libdevuansdk"
     67 	)
     68 
     69 	blend_map=(
     70 		"devuan-desktop-live"    "$R/blends/devuan-desktop-live/devuan-desktop-live.blend"
     71 		"devuan-minimal-live"    "$R/blends/devuan-minimal-live/devuan-minimal-live.blend"
     72 		"heads"          "$R/../heads.blend"
     73 		"decode"         "$R/../decode.blend"
     74 	)
     75 
     76 	oslib="${os_map[$os]}"
     77 	blendlib="${blend_map[$blend]}"
     78 
     79 	[[ $blendlib =~ '^http' ]] && {
     80 		notice "grabbing blend from the internetz"
     81 		mkdir -p $R/extra/blends
     82 		pushd $R/extra/blends
     83 			curl -Ls -O $blendlib
     84 		popd
     85 		blendlib="$R/extra/blends/$(basename $blendlib)"
     86 	}
     87 
     88 	[[ -f $oslib ]]    || { die "no valid distro specified"; exit 1 }
     89 	[[ -f $blendlib ]] || { act "no blend specified" }
     90 
     91 	source $oslib
     92 	[[ -f $blendlib ]] && {
     93 		source $blendlib || zerr
     94 		act "$os blend loaded -- ($blend -- release: $release)"
     95 		export BLEND=1
     96 	}
     97 
     98 	workdir="$R/tmp/${os}-${arch}-build"
     99 	strapdir="$workdir/bootstrap"
    100 	mkdir -p $strapdir
    101 
    102 	export LANG=C
    103 	export LC_ALL=C
    104 
    105 	source $R/lib/zuper/zuper.init
    106 }
    107 
    108 TRAPZERR() { zerr; return $? }
    109 
    110 notice "live-sdk loaded"
    111 export PROMPT="%F{yellow}%(?..%? )%{$reset_color%}livesdk@%{$fg[red]%}%m %{$reset_color%} %{$fg[blue]%}%#%{$fg_bold[blue]%}%{$reset_color%} "
    112 
    113 echo "release is: $release"