@@ -42,13 +42,14 @@ FW_FOLDER="$(realpath $(dirname $0)/../build/fw-base)"
4242check_deps () {
4343 echo " [*] Checking dependencies"
4444 echo " ******************************"
45- echo " "
4645
4746 if [ ! -f " $FW_FOLDER /basefw.bin" ]; then
47+ VARIANT=$( [[ " $FLAVOR " == " nano" ]] && echo " NANO" || echo " TETRA" )
48+
4849 echo " [!] Attention!"
4950 echo " "
5051 echo " File 'build/fw-base/basefw.bin' was not found."
51- echo " You must download the original firmware version 2.7.0 and place it with the name basefw.bin in this path:"
52+ echo " You must download the original $VARIANT firmware version 2.7.0 and place it with the name basefw.bin in this path:"
5253 echo " $FW_FOLDER "
5354 echo " "
5455
@@ -65,12 +66,14 @@ check_deps () {
6566
6667 exit 1
6768 fi
69+
70+ echo " [+] Check completed"
71+ echo " "
6872}
6973
7074prepare_builder () {
7175 echo " [*] Prepare builder"
7276 echo " ******************************"
73- echo " "
7477
7578 PACKAGES_ARQ=" ${ARCHITECTURE} _24kc"
7679 DOWNLOAD_BASE_URL=" https://github.com/xchwarze/wifi-pineapple-community/raw/main/packages/experimental"
@@ -79,82 +82,80 @@ prepare_builder () {
7982 PACKAGE_IPK=" ${TARGET} _${PACKAGES_ARQ} .ipk"
8083 PACKAGE_PATH=" $IMAGEBUILDER_FOLDER /packages/$PACKAGE_IPK "
8184 if [ ! -f " $PACKAGE_PATH " ]; then
82- echo " [+] Install: $TARGET "
85+ echo " [+] Install: $TARGET "
8386 wget -q " $DOWNLOAD_BASE_URL /$PACKAGES_ARQ /$PACKAGE_IPK " -O " $PACKAGE_PATH "
8487 else
85- echo " [+] Already exist: $TARGET "
88+ echo " [+] Already exist: $TARGET "
8689 fi
8790 done
8891
89- echo " [+] Builder setup complete"
92+ echo " [+] Builder setup complete"
9093 echo " "
9194}
9295
9396prepare_build () {
9497 echo " [*] Prepare build"
9598 echo " ******************************"
96- echo " "
9799
98100 # clean
99- rm -rf _basefw.* basefw.bin
101+ rm -rf " $FW_FOLDER / _basefw.*"
100102 rm -rf " $BUILD_FOLDER /rootfs-base"
101103 rm -rf " $BUILD_FOLDER /rootfs"
104+ rm -rf " $BUILD_FOLDER /release"
102105 mkdir " $BUILD_FOLDER /release"
103106
104107 # get target firmware
105108 # this work only with lastest binwalk version!
106109 if [[ " $FLAVOR " == " tetra" || " $FLAVOR " == " universal" ]]; then
107- # echo "[+] Downloading TETRA firmware..."
108- # wget -q https://github.com/xchwarze/wifi-pineapple-community/raw/main/firmwares/2.7.0-tetra.bin -O basefw.bin
110+ # echo " [+] Downloading TETRA firmware..."
111+ # wget -q https://github.com/xchwarze/wifi-pineapple-community/raw/main/firmwares/2.7.0-tetra.bin -O "$FW_FOLDER/ basefw.bin"
109112
110- echo " [+] Unpack firmware for get file system"
111- binwalk basefw.bin -e
112- binwalk _basefw.bin.extracted/sysupgrade-pineapple-tetra/root -e --preserve-symlinks
113- mv _basefw.bin.extracted/sysupgrade-pineapple-tetra/_root.extracted/squashfs-root/ " $BUILD_FOLDER /rootfs-base"
113+ echo " [+] Unpack firmware for get file system"
114+ binwalk " $FW_FOLDER / basefw.bin" -e
115+ binwalk " $FW_FOLDER / _basefw.bin.extracted/sysupgrade-pineapple-tetra/root" -e --preserve-symlinks
116+ mv " $FW_FOLDER / _basefw.bin.extracted/sysupgrade-pineapple-tetra/_root.extracted/squashfs-root/" " $BUILD_FOLDER /rootfs-base"
114117 else
115- # echo "[+] Downloading NANO firmware..."
116- # wget -q https://github.com/xchwarze/wifi-pineapple-community/raw/main/firmwares/2.7.0-nano.bin -O basefw.bin
118+ # echo " [+] Downloading NANO firmware..."
119+ # wget -q https://github.com/xchwarze/wifi-pineapple-community/raw/main/firmwares/2.7.0-nano.bin -O "$FW_FOLDER/ basefw.bin"
117120
118- echo " [+] Unpack firmware for get file system"
119- binwalk basefw.bin -e --preserve-symlinks
120- mv _basefw.bin.extracted/squashfs-root/ " $BUILD_FOLDER /rootfs-base"
121+ echo " [+] Unpack firmware for get file system"
122+ binwalk " $FW_FOLDER / basefw.bin" -e --preserve-symlinks
123+ mv " $FW_FOLDER / _basefw.bin.extracted/squashfs-root/" " $BUILD_FOLDER /rootfs-base"
121124 fi
122125
123- rm -rf _basefw.* basefw.bin
124- # sudo chmod +x "$TOOL_FOLDER/*.sh"
125-
126- echo " [+] Copying the original files"
126+ echo " [+] Copying the original files"
127127 " $TOOL_FOLDER /copier.sh" " $TOOL_FOLDER /../lists/$FLAVOR .filelist" " $BUILD_FOLDER /rootfs-base" " $BUILD_FOLDER /rootfs"
128128 if [ $? -ne 0 ]; then
129- echo " [!] An error occurred while copying the original files. Check the log for errors."
129+ echo " [!] An error occurred while copying the original files. Check the log for errors."
130130 exit 1
131131 fi
132132
133- # I'm deleting it because I don't use it anymore
134133 rm -rf " $BUILD_FOLDER /rootfs-base"
134+ rm -rf " $FW_FOLDER " /_basefw.*
135135
136136 if [[ " $ARCHITECTURE " == " mipsel" ]]; then
137- # echo "[+] Downloading old MK7 firmware..."
138- # wget -q https://github.com/xchwarze/wifi-pineapple-community/raw/main/firmwares/1.1.1-mk7.bin -O basefw-mk7.bin
137+ # echo " [+] Downloading old MK7 firmware..."
138+ # wget -q https://github.com/xchwarze/wifi-pineapple-community/raw/main/firmwares/1.1.1-mk7.bin -O "$FW_FOLDER/ basefw-mk7.bin"
139139
140- echo " [+] Unpack mipsel firmware for get file system"
141- binwalk basefw-mk7.bin -e --preserve-symlinks
142- mv _basefw-mk7.bin.extracted/squashfs-root/ " $BUILD_FOLDER /rootfs-mk7-base"
140+ echo " [+] Unpack mipsel firmware for get file system"
141+ binwalk " $FW_FOLDER / basefw-mk7.bin" -e --preserve-symlinks
142+ mv " $FW_FOLDER / _basefw-mk7.bin.extracted/squashfs-root/" " $BUILD_FOLDER /rootfs-mk7-base"
143143
144- echo " [+] Copying the original mipsel files"
144+ echo " [+] Copying the original mipsel files"
145145 " $TOOL_FOLDER /copier.sh" " $TOOL_FOLDER /../lists/mipsel-support.filelist" " $BUILD_FOLDER /rootfs-mk7-base" " $BUILD_FOLDER /rootfs" " true"
146146 if [ $? -ne 0 ]; then
147- echo " [!] An error occurred while copying the original mipsel files. Check the log for errors."
147+ echo " [!] An error occurred while copying the original mipsel files. Check the log for errors."
148148 exit 1
149149 fi
150150
151151 rm -rf " $BUILD_FOLDER /rootfs-mk7-base"
152+ rm -rf " $FW_FOLDER " /_basefw-mk7.*
152153 fi
153154
154- echo " [+] Patch file system"
155+ echo " [+] Patch file system"
155156 " $TOOL_FOLDER /fs-patcher.sh" " $ARCHITECTURE " " $FLAVOR " " $BUILD_FOLDER /rootfs"
156157 if [ $? -ne 0 ]; then
157- echo " [!] An error occurred during the execution of the process. Check the log for errors."
158+ echo " [!] An error occurred during the execution of the process. Check the log for errors."
158159 exit 1
159160 fi
160161
@@ -164,18 +165,17 @@ prepare_build () {
164165build () {
165166 echo " [*] Build"
166167 echo " ******************************"
167- echo " "
168168
169169 # clean
170- echo " [+] Clean last build data"
170+ echo " [+] Clean last build data"
171171 # make clean
172172 rm -rf " $IMAGEBUILDER_FOLDER /tmp/"
173173 rm -rf " $IMAGEBUILDER_FOLDER /build_dir/target-*/root*"
174174 rm -rf " $IMAGEBUILDER_FOLDER /build_dir/target-*/json_*"
175175 rm -rf " $IMAGEBUILDER_FOLDER /bin/targets/*"
176176
177177 # set selected packages
178- echo " [+] Executing make"
178+ echo " [+] Executing make"
179179 selected_packages=" $PACKAGES_UNIVERSAL "
180180 if [[ " $FLAVOR " == " nano" ]];
181181 then
@@ -190,15 +190,15 @@ build () {
190190 make image PROFILE=" $1 " PACKAGES=" $selected_packages " FILES=" $BUILD_FOLDER /rootfs" BIN_DIR=" $BUILD_FOLDER /release" > " $BUILD_FOLDER /release/make.log"
191191 if [ $? -ne 0 ]; then
192192 echo " "
193- echo " [!] An error occurred in the build process. Check file release/make.log for more information."
193+ echo " [!] An error occurred in the build process. Check file release/make.log for more information."
194194 exit 1
195195 fi
196196
197197 # add this second check for build process
198198 checkFwFileExist=$( ls " $BUILD_FOLDER /release" /* -sysupgrade.* 2> /dev/null | wc -l)
199199 if [ $checkFwFileExist -eq 0 ]; then
200200 echo " "
201- echo " [!] OpenWRT finished the build process but no firmware was found. Check the release/make.log to see if the process was completed correctly."
201+ echo " [!] OpenWRT finished the build process but no firmware was found. Check the release/make.log to see if the process was completed correctly."
202202 # exit 1
203203 fi
204204 echo " "
0 commit comments