-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·123 lines (108 loc) · 3.58 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# build.sh
# Created on: Sat 24 Sep 2022 02:07:07 AM BST
#
# ____ __ ____ __
# ( _ \ /. |( _ \/ )
# )___/(_ _))___/ )(
# (__) (_)(__) (__)
#
# Description:
# Generate pacman ignore list
# /bin/ls archlive/airootfs/usr/lib/ | xargs -l -I {} echo /tmp/build_dir/x86_64/airootfs/usr/lib/{} > ignore.txt
# cat ignore.txt | tr '\n' ' ' > ignore2.t
ISO_BUILD_DIR=$PWD/build_dir/
BACKUP_FILE=./backup.tar.xz
LINK_TO_BACKUP=https://leosmith.wtf/rice/$BACKUP_FILE
HOME_ARCHLIVE=./archlive/airootfs/etc/skel
ROOT_ARCHLIVE=./archlive/airootfs
BIN_ARCHLIVE=./archlive/airootfs/usr/local/bin
BACKUP_FOLDER=./backup/
PACKAGER_FOLDER=./packager
PACKAGER_REPO=https://github.com/p3ng0s/packager
# Display usage information
function usage () {
echo -e "\e[1;31mUsage:\e[m" 1>&2
echo "$0 -b -> Build only." 1>&2
echo "$0 -p -> Pakcages only." 1>&2
echo "$0 -c -> Delete all temp folder and build folder." 1>&2
exit -1
}
while getopts "bpc" o; do
case "${o}" in
c)
echo -e "Removing the $PACKAGER_FOLDER folder -> \e[36m:)\e[0m"
rm $PACKAGER_FOLDER
echo -e "Removing the $BACKUP_FOLDER folder -> \e[36m:)\e[0m"
rm $BACKUP_FOLDER
echo -e "Delete $ISO_BUILD_DIR -> \e[36m:)\e[0m"
rm -rf $ISO_BUILD_DIR
echo -e "Delete $PWD/out/ -> \e[36m:)\e[0m"
rm -rf $PWD/out/
exit
;;
b)
whoami
echo -e "SUDO Big .iso build see you tomorrow -> \e[36m:)\e[0m"
sudo mkarchiso -v -w $ISO_BUILD_DIR $PWD/archlive/
echo -e "All done -> \e[36m:)\e[0m"
exit 0
;;
p)
git clone $PACKAGER_REPO
BUILD_TMP_DIR=$(pwd)
cd $PACKAGER_FOLDER
./setup.sh
cd $BUILD_TMP_DIR
echo -e "Installed p3ng0s repositories -> \e[36m:)\e[0m"
exit 0
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
# Do the basic checks to see if root and on supported systems and if the user exitsts
if [ "$EUID" -eq 0 ]; then
echo -e "\e[1;31mPlease do not run as root\e[m"
exit -1
fi
# Download backup
echo -e "Fetching backup -> \e[36m:)\e[0m"
curl $LINK_TO_BACKUP --output $PWD/$BACKUP_FILE
tar -xf $BACKUP_FILE
## move config
[ -d "$BACKUP_FOLDER/.vim/" ] && cp -r $BACKUP_FOLDER/.vim/ $HOME_ARCHLIVE
[ -d "$BACKUP_FOLDER/.tmux/" ] && cp -r $BACKUP_FOLDER/.tmux/ $HOME_ARCHLIVE
[ -d "$BACKUP_FOLDER/.fzf/" ] && cp -r $BACKUP_FOLDER/.fzf/ $HOME_ARCHLIVE
[ -f "$BACKUP_FOLDER/.gdbinit" ] && cp -r $BACKUP_FOLDER/.gdbinit $HOME_ARCHLIVE
[ -f "$BACKUP_FOLDER/.Xresources" ] && cp -r $BACKUP_FOLDER/.Xresources $HOME_ARCHLIVE
[ -f "$BACKUP_FOLDER/.tmux.conf" ] && cp -r $BACKUP_FOLDER/.tmux.conf $HOME_ARCHLIVE
[ -f "$BACKUP_FOLDER/.vimrc" ] && cp -r $BACKUP_FOLDER/.vimrc $HOME_ARCHLIVE
[ -f "$BACKUP_FOLDER/.bashrc" ] && cp -r $BACKUP_FOLDER/.bashrc $HOME_ARCHLIVE
[ -f "$BACKUP_FOLDER/.tigrc" ] && cp -r $BACKUP_FOLDER/.tigrc $HOME_ARCHLIVE
options=( "None" "" )
for item in "$PWD/archlive/airootfs/etc/p3ng0s/wallpaper/"*; do
[ -e "$item" ] || continue # Skip non-existent files
options+=("$item" "")
done
choice=$(dialog --menu "Select a file" 0 0 0 "${options[@]}" 2>&1 >/dev/tty)
if [ ! $choice = "None" ]; then
cp -r $choice $HOME_ARCHLIVE/.wallpaper.png
fi
echo -e "Moved terminal config to archlive -> \e[36m:)\e[0m"
# setup for startx with the live version of the windows manager
[ ! -f $HOME_ARCHLIVE/.xinitrc ] && echo "exec dwm-live" > $HOME_ARCHLIVE/.xinitrc
git clone $PACKAGER_REPO
BUILD_TMP_DIR=$(pwd)
cd $PACKAGER_FOLDER
./setup.sh
cd $BUILD_TMP_DIR
echo -e "Installed p3ng0s repositories -> \e[36m:)\e[0m"
# Last step build iso
whoami
echo -e "SUDO Big .iso build see you tomorrow -> \e[36m:)\e[0m"
sudo mkarchiso -v -w $ISO_BUILD_DIR $PWD/archlive/
echo -e "All done -> \e[36m:)\e[0m"
exit 0