preserve bash history too (#454)

This commit is contained in:
Bennett Perkins 2023-01-17 19:41:30 +08:00 committed by GitHub
parent 8f582eec68
commit 6d2fb02344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,13 @@
#!/bin/sh
mkdir -p /mnt/data/.home
if [ ! -f /mnt/data/.home/.ash_history ]; then
cp /root/.ash_history /mnt/data/.home/.ash_history
for file in .ash_history .bash_history
if [ ! -f /mnt/data/.home/$file ]; then
touch /root/$file
cp /root/$file /mnt/data/.home/$file
chown root:root /mnt/data/.home/$file
chmod 0600 /mnt/data/.home/$file
fi
ln -sf /mnt/data/.home/.ash_history /root/.ash_history
ln -sf /mnt/data/.home/$file /root/$file