RDP 초기 설정 스크립트 입력 처리 수정 (curl | bash 지원)

- 모든 read 명령에 </dev/tty 추가
- curl | bash 실행 시 표준 입력 문제 해결
- 파이프로 실행해도 사용자 입력 정상 작동
- 5개 입력 포인트 모두 수정:
  - RDP 서버 주소
  - RDP 사용자명
  - RDP 패스워드 (2회)
  - 로컬 사용자명
  - 설정 확인
  - 네트워크 연결 실패 시 계속 진행 여부
  - 재부팅 확인

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude 2025-11-17 01:02:31 +00:00
parent d0c8b26138
commit ccd34c7f54

View File

@ -123,7 +123,7 @@ get_user_input() {
# RDP 서버 정보 (검증 포함)
while true; do
read -p "RDP 서버 주소 (예: example.com:3389): " RDP_SERVER
read -p "RDP 서버 주소 (예: example.com:3389): " RDP_SERVER </dev/tty
if [ -z "$RDP_SERVER" ]; then
msg_error "RDP 서버 주소는 필수입니다."
elif ! validate_rdp_server "$RDP_SERVER"; then
@ -134,10 +134,10 @@ get_user_input() {
break
fi
done
# 사용자명 (검증 포함)
while true; do
read -p "RDP 사용자명: " RDP_USERNAME
read -p "RDP 사용자명: " RDP_USERNAME </dev/tty
if [ -z "$RDP_USERNAME" ]; then
msg_error "RDP 사용자명은 필수입니다."
elif ! validate_username "$RDP_USERNAME"; then
@ -147,20 +147,20 @@ get_user_input() {
break
fi
done
# 패스워드 (재확인 포함)
while true; do
echo -n "RDP 패스워드: "
read -s RDP_PASSWORD
read -s RDP_PASSWORD </dev/tty
echo ""
if [ -z "$RDP_PASSWORD" ]; then
msg_error "RDP 패스워드는 필수입니다."
fi
echo -n "패스워드 확인: "
read -s password_confirm
read -s password_confirm </dev/tty
echo ""
if [ "$RDP_PASSWORD" != "$password_confirm" ]; then
msg_warn "패스워드가 일치하지 않습니다. 다시 입력해주세요."
continue
@ -168,12 +168,12 @@ get_user_input() {
break
fi
done
# 로컬 사용자명 (선택사항, 검증 포함)
while true; do
read -p "로컬 사용자명 [rdpuser]: " LOCAL_USER
read -p "로컬 사용자명 [rdpuser]: " LOCAL_USER </dev/tty
LOCAL_USER=${LOCAL_USER:-rdpuser}
if ! validate_username "$LOCAL_USER"; then
msg_warn "잘못된 로컬 사용자명 형식입니다. 영문, 숫자, ., _, - 만 사용 가능합니다."
continue
@ -192,7 +192,7 @@ get_user_input() {
# 최종 확인
local attempts=0
while [ $attempts -lt 3 ]; do
read -p "설정을 계속하시겠습니까? [y/N]: " confirm
read -p "설정을 계속하시겠습니까? [y/N]: " confirm </dev/tty
case $confirm in
[yY]|[yY][eE][sS])
return 0
@ -206,7 +206,7 @@ get_user_input() {
;;
esac
done
msg_error "너무 많은 잘못된 입력으로 설정이 취소되었습니다."
}
@ -252,7 +252,7 @@ check_network() {
if command -v timeout > /dev/null; then
if ! timeout 10 bash -c "</dev/tcp/$server_host/$server_port" > /dev/null 2>&1; then
msg_warn "RDP 서버에 연결할 수 없습니다. 서버 주소와 포트를 확인해주세요."
read -p "계속 진행하시겠습니까? [y/N]: " continue_anyway
read -p "계속 진행하시겠습니까? [y/N]: " continue_anyway </dev/tty
case $continue_anyway in
[yY]|[yY][eE][sS]) ;;
*) msg_error "설정이 취소되었습니다." ;;
@ -495,8 +495,8 @@ print_completion() {
echo " 3. 문제 발생 시 Ctrl+Alt+F2로 다른 터미널에 접근 가능합니다"
echo ""
echo -e "${CYAN}재부팅하시겠습니까? [y/N]:${NC} "
read -r reboot_confirm
read -r reboot_confirm </dev/tty
case $reboot_confirm in
[yY]|[yY][eE][sS])
msg_info "시스템을 재부팅합니다..."