Added hostname

This commit is contained in:
Kevin Veen-Birkenbach 2020-04-30 17:31:30 +02:00
parent 2faf488d58
commit 0b16092ebf
2 changed files with 18 additions and 15 deletions

View File

@ -3,10 +3,9 @@ This repository contains some shell scripts to install Arch Linux for the Raspbe
## Todo
- Implement hostname setting
- Implement password change
- Implement ssh configuration
- Implement wifi automation
- Hostname
## Setup
### SD-Card
#### Guided
@ -21,13 +20,14 @@ To pase the configuration to the program use this syntax:
(
echo "$USER" # | The username
echo "mmcblk1" # | The device
echo "4" # | The raspberry pi number
echo "retropie" # | The operation system
echo "3" # | The raspberry pi number
echo "arch" # | The operation system
echo "n" # | Force image download
echo "n" # | Transfer image
#echo "n" # ├── Overwrite device before copying
echo "test12345" # | The user password
echo "test12345" # | The root password
echo "test12345" # | The user password
echo "test12345" # | The root password
echo "example-host" # | The hostname
echo "y" # | Copy wifi configurations to target system
)| sudo bash ./sd_setup.sh
```

View File

@ -37,7 +37,7 @@ success(){
destructor(){
info "Cleaning up..."
sed -i 's/^#CHROOT //g' "$root_mount_path/etc/ld.so.preload"
sed -i 's/^#CHROOT //g' "$root_mount_path""etc/ld.so.preload"
umount -v "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!"
umount -v "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!"
umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!"
@ -333,7 +333,7 @@ mount --bind /sys "$chroot_sys_mount_path" || error "Mounting $chroot_sys_mount_
mount --bind /proc "$chroot_proc_mount_path" || error "Mounting $chroot_proc_mount_path failed."
mount --bind /dev/pts "$chroot_dev_pts_mount_path" || error "Mounting $chroot_dev_pts_mount_path failed."
sed -i 's/^/#CHROOT /g' /mnt/raspbian/etc/ld.so.preload
sed -i 's/^/#CHROOT /g' "$root_mount_path""etc/ld.so.preload"
cp -v /usr/bin/qemu-arm-static "$root_mount_path""/usr/bin/" || error "Copy qemu-arm-static failed. The following packages are neccessary: qemu qemu-user-static binfmt-support."
info "Changing passwords on target system..."
@ -355,13 +355,16 @@ if [ "$password_1" == "$password_2" ]
error "Passwords didn't match."
fi
question "Do you want to copy all Wifi passwords to the device?(y/n)" && read -r copy_wifi
if [ "$copy_wifi" = "y" ]
then
origin_wifi_config_path="/etc/NetworkManager/system-connections/"
target_wifi_config_path="$root_mount_path$origin_wifi_config_path"
rsync -av "$origin_wifi_config_path" "$target_wifi_config_path"
fi
question "Type in the hostname:" && read -r hostname;
echo "$hostname" > "$root_mount_path""etc/hostname" | error "Changing hostname failed."
# question "Do you want to copy all Wifi passwords to the device?(y/n)" && read -r copy_wifi
# if [ "$copy_wifi" = "y" ]
# then
# origin_wifi_config_path="/etc/NetworkManager/system-connections/"
# target_wifi_config_path="$root_mount_path$origin_wifi_config_path"
# rsync -av "$origin_wifi_config_path" "$target_wifi_config_path"
# fi
info "The first level folder structure on $root_mount_path is:" && tree -laL 1 "$root_mount_path"
info "The first level folder structure on $boot_mount_path is:" && tree -laL 1 "$boot_mount_path"