asdf
This commit is contained in:
		
							parent
							
								
									315f968e6e
								
							
						
					
					
						commit
						518be21bef
					
				| 
						 | 
					@ -1,31 +1,56 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO: check for rust dependency
 | 
					# variables
 | 
				
			||||||
 | 
					PKG_NAME=rustmon
 | 
				
			||||||
 | 
					BUILD_DIR=build/debian
 | 
				
			||||||
 | 
					RELEASE_DIR=../../target/release
 | 
				
			||||||
 | 
					DEBIAN_DIR=$PKG_NAME/DEBIAN
 | 
				
			||||||
 | 
					BIN_DIR=$PKG_NAME/usr/bin
 | 
				
			||||||
 | 
					AUTO_INSTALL=${1:-"no"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# create a directory structure that mirrors tha final structure of the installed package
 | 
					# check for rust
 | 
				
			||||||
mkdir -p rustmon/DEBIAN
 | 
					if ! command -v rustc &> /dev/null
 | 
				
			||||||
mkdir -p rustmon/usr/bin
 | 
					then
 | 
				
			||||||
 | 
					    if [ "$AUTO_INSTALL" = "-y" ]; then
 | 
				
			||||||
 | 
					        echo "Rust is not installed. Auto-installing..."
 | 
				
			||||||
 | 
					        sudo apt install rustc
 | 
				
			||||||
 | 
					        source $HOME/.cargo/env
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        echo "Rust is not installed. Would you like to install it now? (yes/no)"
 | 
				
			||||||
 | 
					        read answer
 | 
				
			||||||
 | 
					        if [ "$answer" != "${answer#[Yy]}" ] ;then
 | 
				
			||||||
 | 
					            curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
 | 
				
			||||||
 | 
					            source $HOME/.cargo/env
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            echo "Rust is required to continue. Exiting."
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# build the executable
 | 
					# create directory structure
 | 
				
			||||||
 | 
					mkdir -p $DEBIAN_DIR
 | 
				
			||||||
 | 
					mkdir -p $BIN_DIR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Bbild the executable
 | 
				
			||||||
cd ../..
 | 
					cd ../..
 | 
				
			||||||
cargo build --release
 | 
					cargo build --release
 | 
				
			||||||
cd build/debian
 | 
					cd $BUILD_DIR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# copy the executable
 | 
					# copy the executable
 | 
				
			||||||
cp ../../target/release/rustmon rustmon/usr/bin/
 | 
					cp $RELEASE_DIR/$PKG_NAME $BIN_DIR/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# create the control file
 | 
					# create the control file
 | 
				
			||||||
touch rustmon/DEBIAN/control
 | 
					touch $DEBIAN_DIR/control
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# edit the control file
 | 
					# edit the control file
 | 
				
			||||||
echo "Package: rustmon
 | 
					echo "Package: $PKG_NAME
 | 
				
			||||||
Version: 1.0.0
 | 
					Version: 1.0.0
 | 
				
			||||||
Section: base
 | 
					Section: base
 | 
				
			||||||
Priority: optional
 | 
					Priority: optional
 | 
				
			||||||
Architecture: amd64
 | 
					Architecture: amd64
 | 
				
			||||||
Maintainer: Vomitblood <tohyouxuan@gmail.com>
 | 
					Maintainer: Vomitblood <tohyouxuan@gmail.com>
 | 
				
			||||||
Description: "Pokemon Colorscripts written in Rust"" > rustmon/DEBIAN/control
 | 
					Description: Pokemon Colorscripts written in Rust" > $DEBIAN_DIR/control
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# actually build the thing
 | 
					# build the package
 | 
				
			||||||
echo $(pwd)
 | 
					dpkg-deb --build $PKG_NAME
 | 
				
			||||||
dpkg-deb --build rustmon
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in a new issue