Skip to content

Commit 40ffa70

Browse files
authored
Merge pull request #21 from kristapsk/clear-stuff-2
clear logs, shell history, ssh keys and networks
2 parents b70e09c + 890b7f8 commit 40ffa70

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Default configuration file for wpa_supplicant.conf(5).
2+
3+
ctrl_interface=/run/wpa_supplicant
4+
ctrl_interface_group=wheel
5+
eapol_version=1
6+
ap_scan=1
7+
fast_reauth=1
8+
update_config=1
9+
passive_scan=1
10+
11+
# Add here your networks.
12+

tools/finalize-nakamochi.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
# shellcheck disable=SC2064
33

4+
base_dir="$(dirname "$(readlink -m "$0")")"
5+
46
check_exists()
57
{
68
command -v "$1" > /dev/null
@@ -91,7 +93,7 @@ run_main()
9193
exit 1
9294
fi
9395

94-
if [[ ! -x "$(dirname "$0")/rpcauth.py" ]]; then
96+
if [[ ! -x "$base_dir/rpcauth.py" ]]; then
9597
echo "Error: rpcauth.py not found or is not executable."
9698
exit 1
9799
fi
@@ -231,7 +233,7 @@ run_main()
231233
# generate a bitcoin RPC auth
232234
echo -n "Generating bitcoin RPC auth ... "
233235
bitcoind_rpcuser="rpc"
234-
rpcauth_out="$(python3 "$(dirname "$0")/rpcauth.py" $bitcoind_rpcuser)"
236+
rpcauth_out="$(python3 "$base_dir/rpcauth.py" $bitcoind_rpcuser)"
235237
if [[ -z $rpcauth_out ]]; then
236238
echo ""
237239
echo "Error: failed to generate bitcoin RPC auth."
@@ -287,11 +289,21 @@ run_main()
287289
if [[ "$update_update" -eq 1 ]]; then
288290
# update /sysupdates/update.sh on SSD from local copy
289291
echo -n "Updating /sysupdates/update.sh on SSD ... "
290-
cp "$(dirname "$0")/update.sh" "$SSD_MOUNT_POINT"/sysupdates/update.sh
292+
cp "$base_dir/update.sh" "$SSD_MOUNT_POINT"/sysupdates/update.sh
291293
chmod +x "$SSD_MOUNT_POINT"/sysupdates/update.sh
292294
echo "done."
293295
fi
294296

297+
# clear logs, shell history, ssh keys and networks
298+
echo -n "Clearing logs, shell history, ssh keys and networks ... "
299+
rm -f "$USD_MOUNT_POINT"/var/log/* 2> /dev/null
300+
for d in "$USD_MOUNT_POINT"/var/log/socklog/*; do echo > "$d/current"; done
301+
rm -f "$USD_MOUNT_POINT"/root/.bash_history
302+
mkdir -p "$USD_MOUNT_POINT"/root/.ssh
303+
echo > "$USD_MOUNT_POINT"/root/.ssh/authorized_keys
304+
cp "$base_dir"/../rootfiles/etc/wpa_supplicant/wpa_supplicant.conf "$USD_MOUNT_POINT"/etc/wpa_supplicant/wpa_supplicant.conf
305+
echo "done."
306+
295307
sync
296308
echo "All DONE, Nakamochi uSD and SSD should be ready!"
297309
}

0 commit comments

Comments
 (0)