update isntall script to chose host
This commit is contained in:
parent
efa5f58745
commit
3298c6a47f
26
install.sh
26
install.sh
|
@ -62,6 +62,25 @@ set_username() {
|
||||||
sed -i -e "s/${CURRENT_USERNAME}/${username}/g" ./modules/home/audacious/config
|
sed -i -e "s/${CURRENT_USERNAME}/${username}/g" ./modules/home/audacious/config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_host() {
|
||||||
|
echo -en "Chose a ${GREEN}host${NORMAL}, either [${YELLOW}D${NORMAL}]esktop or [${YELLOW}L${NORMAL}]aptop: "
|
||||||
|
read -n 1 -r
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [[ $REPLY =~ ^[Dd]$ ]]; then
|
||||||
|
HOST='desktop'
|
||||||
|
elif [[ $REPLY =~ ^[Ll]$ ]]; then
|
||||||
|
HOST='laptop'
|
||||||
|
else
|
||||||
|
echo "Invalid choice. Please select either 'D' for desktop or 'L' for laptop."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -en "$NORMAL"
|
||||||
|
echo -en "Use the$YELLOW "$HOST"$NORMAL ${GREEN}host${NORMAL} ? "
|
||||||
|
comfirm
|
||||||
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
echo -e "\n${RED}START INSTALL PHASE${NORMAL}\n"
|
echo -e "\n${RED}START INSTALL PHASE${NORMAL}\n"
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
|
@ -83,8 +102,8 @@ install() {
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
|
|
||||||
# Get the hardware configuration
|
# Get the hardware configuration
|
||||||
echo -e "Copying ${MAGENTA}/etc/nixos/hardware-configuration.nix${NORMAL} to ${MAGENTA}./hosts/nixos/${NORMAL}\n"
|
echo -e "Copying ${MAGENTA}/etc/nixos/hardware-configuration.nix${NORMAL} to ${MAGENTA}./hosts/${HOST}/${NORMAL}\n"
|
||||||
cp /etc/nixos/hardware-configuration.nix hosts/desktop/hardware-configuration.nix
|
cp /etc/nixos/hardware-configuration.nix hosts/${HOST}/hardware-configuration.nix
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
|
|
||||||
# Last Confirmation
|
# Last Confirmation
|
||||||
|
@ -93,7 +112,7 @@ install() {
|
||||||
|
|
||||||
# Build the system (flakes + home manager)
|
# Build the system (flakes + home manager)
|
||||||
echo -e "\nBuilding the system...\n"
|
echo -e "\nBuilding the system...\n"
|
||||||
sudo nixos-rebuild switch --flake .#desktop
|
sudo nixos-rebuild switch --flake .#${HOST}
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
@ -103,6 +122,7 @@ main() {
|
||||||
|
|
||||||
get_username
|
get_username
|
||||||
set_username
|
set_username
|
||||||
|
get_host
|
||||||
|
|
||||||
install
|
install
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue