post install script
This commit is contained in:
parent
a21989bf15
commit
b1079497c8
3 changed files with 87 additions and 24 deletions
32
devware.csv
32
devware.csv
|
@ -1,16 +1,16 @@
|
||||||
NAME,DESCRIPTION,GIT,GIT URL
|
NAME,DESCRIPTION,GIT,
|
||||||
build-base,"Meta package for build base",N,
|
build-base,"Meta package for build base",D,
|
||||||
tcc,"Tiny C Compiler",N,
|
tcc,"Tiny C Compiler",D,
|
||||||
tcc-libs,"Tiny C Compiler (libraries)",N,
|
tcc-libs,"Tiny C Compiler (libraries)",D,
|
||||||
tcc-libs-static,"Tiny C Compiler (static library)",N,
|
tcc-libs-static,"Tiny C Compiler (static library)",D,
|
||||||
clang20,"C language family front-end for LLVM",N,
|
clang20,"C language family front-end for LLVM",D,
|
||||||
libinput,"Library for handling input devices",N,
|
libinput,"Library for handling input devices",D,
|
||||||
libinput-dev,"Library for handling input devices (development files)",N,
|
libinput-dev,"Library for handling input devices (development files)",D,
|
||||||
wayland,"A computer display server protocol",N,
|
wayland,"A computer display server protocol",D,
|
||||||
wayland-dev,"A computer display server protocol (development files)",N,
|
wayland-dev,"A computer display server protocol (development files)",D,
|
||||||
wlroots,"Modular Wayland compositor library",N,
|
wlroots,"Modular Wayland compositor library",D,
|
||||||
wlroots-dev,"Modular Wayland compositor library (development files)",N,
|
wlroots-dev,"Modular Wayland compositor library (development files)",D,
|
||||||
libxkbcommon,"keyboard handling library",N,
|
libxkbcommon,"keyboard handling library",D,
|
||||||
libxkbcommon-dev,"keyboard handling library (development files)",N,
|
libxkbcommon-dev,"keyboard handling library (development files)",D,
|
||||||
wayland-protocols,"Protocols and protocol extensions complementing the Wayland core protocol",N,
|
wayland-protocols,"Protocols and protocol extensions complementing the Wayland core protocol",D,
|
||||||
pkgconf,"development framework configuration tools",N,
|
pkgconf,"development framework configuration tools",D,
|
||||||
|
|
|
31
installer.sh
31
installer.sh
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
dotfiles="https://git.amolinae.com/amolinae06/dotfiles.git"
|
dotfiles="https://git.amolinae.com/amolinae06/dotfiles.git"
|
||||||
software="software.csv"
|
software="https://git.amolinae.com/amolinae06/installer/raw/branch/main/software.csv"
|
||||||
devsoftware="devware.csv"
|
postinstall="https://git.amolinae.com/amolinae06/installer/raw/branch/main/postinstall.sh"
|
||||||
|
|
||||||
apk_install(){
|
apk_install(){
|
||||||
echo "installing $1"; apk add "$1" >/dev/null 2>&1
|
echo "installing $1"; apk add "$1" >/dev/null 2>&1
|
||||||
|
@ -18,13 +18,17 @@ deploy_dotfiles(){
|
||||||
}
|
}
|
||||||
|
|
||||||
read_software(){
|
read_software(){
|
||||||
tail -n +2 "$software" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do
|
([ -f "$1" ] && cp "$1" /tmp/temp.csv) || wget -qO- "$1" > /tmp/temp.csv
|
||||||
|
|
||||||
|
tail -n +2 "/tmp/temp.csv" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do
|
||||||
case "$GIT" in
|
case "$GIT" in
|
||||||
"N") apk_install $NAME ;;
|
"N") apk_install $NAME ;;
|
||||||
"Y") git_install "$GIT_URL" ;;
|
"Y") git_install "$GIT_URL" ;;
|
||||||
*) echo "ERROR: failed to determine $NAME."; exit 1 ;;
|
*) echo "ERROR: failed to determine $NAME."; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm "/tmp/temp.csv"
|
||||||
printf "Successfully installed all software!\n"
|
printf "Successfully installed all software!\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +53,9 @@ EOF
|
||||||
|
|
||||||
setup_shell(){
|
setup_shell(){
|
||||||
sed -i "/^$user:/s#:[^:]*\$#:/bin/zsh#" /etc/passwd
|
sed -i "/^$user:/s#:[^:]*\$#:/bin/zsh#" /etc/passwd
|
||||||
|
mkdir -p "/home/$user/.cache/zsh"
|
||||||
|
touch "/home/$user/.cache/zsh/history"
|
||||||
|
chown -R "$user":"$user" "/home/$user/.cache/"
|
||||||
echo "changed "$user"'s shell to zsh"
|
echo "changed "$user"'s shell to zsh"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,21 +70,28 @@ setup_home(){
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_chroot(){
|
setup_chroot(){
|
||||||
printf "Setting up chroot"
|
printf "Setting up chroot\n"
|
||||||
apk_install curl
|
apk_install curl
|
||||||
cd "/home/$user/Documents/Miscellaneous"
|
cd "/home/$user/Documents/Miscellaneous"
|
||||||
mkdir alpchroot
|
mkdir alpchroot
|
||||||
curl -LO https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/apk-tools-static-2.14.4-r1.apk
|
curl -LO https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/apk-tools-static-2.14.4-r1.apk
|
||||||
tar -xzf apk-tools-static-*.apk
|
tar -xzf apk-tools-static-*.apk
|
||||||
./sbin/apk.static -X https://dl-cdn.alpinelinux.org/alpine/v3.20/main -U --allow-untrusted -p ${chroot_dir} --initdb add alpine-base
|
./sbin/apk.static -X https://dl-cdn.alpinelinux.org/alpine/v3.20/main -U --allow-untrusted -p alpchroot/ --initdb add alpine-base
|
||||||
mount -o bind /dev alpchroot/dev
|
mount -o bind /dev alpchroot/dev
|
||||||
mount -t proc none alpchroot/proc
|
mount -t proc none alpchroot/proc
|
||||||
mount -o bind /sys alpchroot/sys
|
mount -o bind /sys alpchroot/sys
|
||||||
cp -L /etc/resolv.conf alpchroot/etc/
|
cp -L /etc/resolv.conf alpchroot/etc/
|
||||||
chown -R "$user":"$user" alpchroot/
|
chown -R "$user":"$user" alpchroot/ >/dev/null 2>&1
|
||||||
mkdir -p alpchroot/etc/apk
|
mkdir -p alpchroot/etc/apk
|
||||||
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" > alpchroot/etc/apk/repositories
|
cp /etc/apk/repositories alpchroot/etc/apk/repositories
|
||||||
apk del curl
|
apk del curl
|
||||||
|
printf "Finished setting up chroot!\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_install(){
|
||||||
|
printf "Postinstall\n"
|
||||||
|
([ -f "$postinstall" ] && cp "$postinstall" /tmp/postinstall.sh) || wget -qO- "$1" > /tmp/postinstall.sh
|
||||||
|
su - "$user" -c "zsh -lc 'sh /tmp/postinstall.sh \"$@\" '"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_root(){
|
check_root(){
|
||||||
|
@ -95,10 +109,11 @@ check_root
|
||||||
echo "Welcome to the installer"
|
echo "Welcome to the installer"
|
||||||
apk_install git
|
apk_install git
|
||||||
get_user
|
get_user
|
||||||
read_software
|
read_software "$software"
|
||||||
setup_home
|
setup_home
|
||||||
deploy_dotfiles
|
deploy_dotfiles
|
||||||
setup_greetd
|
setup_greetd
|
||||||
setup_shell
|
setup_shell
|
||||||
setup_bluetooth
|
setup_bluetooth
|
||||||
setup_chroot
|
setup_chroot
|
||||||
|
post_install "$user"
|
||||||
|
|
48
postinstall.sh
Normal file
48
postinstall.sh
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
software="https://git.amolinae.com/amolinae06/installer/raw/branch/main/devware.csv"
|
||||||
|
|
||||||
|
apk_install(){
|
||||||
|
echo "installing $1"; bwroot apk add "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
read_software(){
|
||||||
|
([ -f "$1" ] && cp "$1" /tmp/temp.csv) || wget -qO- "$1" > /tmp/temp.csv
|
||||||
|
|
||||||
|
tail -n +2 "/tmp/temp.csv" | sed -E ':a; s/("[^"]*),([^"]*")/\1\2/; ta' | while IFS=',' read -r NAME DESCRIPTION GIT GIT_URL; do
|
||||||
|
case "$GIT" in
|
||||||
|
"D") apk_install $NAME ;;
|
||||||
|
*) echo "ERROR: failed to determine $NAME."; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
rm "/tmp/temp.csv"
|
||||||
|
printf "Successfully installed all software!\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_dwl() {
|
||||||
|
cd $HOME/.local/src/dwl/
|
||||||
|
bwroot make install
|
||||||
|
}
|
||||||
|
|
||||||
|
make_slstatus() {
|
||||||
|
cd $HOME/.local/src/slstatus/
|
||||||
|
bwroot make install
|
||||||
|
}
|
||||||
|
|
||||||
|
make_ctpv() {
|
||||||
|
cd $HOME/.local/src/hellwal/
|
||||||
|
bwroot make install
|
||||||
|
}
|
||||||
|
|
||||||
|
make_hellwal() {
|
||||||
|
cd $HOME/.local/src/hellwal/
|
||||||
|
bwroot make install
|
||||||
|
}
|
||||||
|
|
||||||
|
cd "/home/$@/"
|
||||||
|
read_software $software
|
||||||
|
make_dwl
|
||||||
|
make_slstatus
|
||||||
|
make_ctpv
|
||||||
|
make_hellwal
|
Loading…
Add table
Add a link
Reference in a new issue